Skip to content

Commit

Permalink
feat: 取消暂时无法实现的生效次数统计功能
Browse files Browse the repository at this point in the history
  • Loading branch information
WankkoRee committed May 15, 2022
1 parent bdc23d3 commit 5701485
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import android.graphics.Paint
import android.graphics.drawable.Drawable
import android.icu.text.Collator
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down Expand Up @@ -155,7 +154,6 @@ class Apps : AppCompatActivity() {
!app.applicationInfo.enabled,
get(AppSP.is_enabled),
hooks.size,
hooks.fold(0) { sum, hash -> sum + getInt("hook_times_$hash", 0) },
)
}
appList.add(appItem)
Expand All @@ -165,7 +163,6 @@ class Apps : AppCompatActivity() {
adapter.init(
appList.sortedWith(
compareByDescending<AppListItemAdapter.AppListItem>{it.isEnabled}
.thenByDescending{it.hookTimes}
.thenByDescending{it.ruleNumbers}
.thenBy{it.isSystemApp}
.thenBy(Collator.getInstance()){it.name}
Expand Down Expand Up @@ -214,7 +211,6 @@ class Apps : AppCompatActivity() {
oldItem.versionName == newItem.versionName &&
oldItem.versionCode == newItem.versionCode &&
oldItem.ruleNumbers == newItem.ruleNumbers &&
oldItem.hookTimes == newItem.hookTimes &&
oldItem.isSystemApp == newItem.isSystemApp &&
oldItem.isNoNetwork == newItem.isNoNetwork
}
Expand Down Expand Up @@ -243,7 +239,6 @@ class Apps : AppCompatActivity() {
filteredData.add(p, raw)
if (partialRefresh) {
notifyItemInserted(p)
Log.i("WankkoRee", "notifyItemInserted(${p})")
}
p++
}
Expand All @@ -252,7 +247,6 @@ class Apps : AppCompatActivity() {
filteredData.removeAt(p)
if (partialRefresh) {
notifyItemRemoved(p)
Log.i("WankkoRee", "notifyItemRemoved(${p})")
}
} else {
p++
Expand All @@ -275,7 +269,7 @@ class Apps : AppCompatActivity() {
holder.nameView.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()
holder.versionView.text = context!!.getString(R.string.version_format).format(filteredData[position].versionName, filteredData[position].versionCode)
holder.packageView.text = filteredData[position].pkg
holder.stateView.text = context!!.getString(R.string.applistitem_num).format(context!!.getString(if (filteredData[position].isEnabled) R.string.enabled else R.string.disabled), filteredData[position].ruleNumbers, filteredData[position].hookTimes)
holder.stateView.text = context!!.getString(R.string.applistitem_num).format(context!!.getString(if (filteredData[position].isEnabled) R.string.enabled else R.string.disabled), filteredData[position].ruleNumbers)
holder.isSystemAppView.color = context!!.getColor(if (!filteredData[position].isSystemApp) R.color.backgroundSuccess else R.color.backgroundError)
holder.isSystemAppView.text = context!!.getString(if (!filteredData[position].isSystemApp) R.string.user_application else R.string.system_application)
holder.isNoNetworkView.color = context!!.getColor(if (!filteredData[position].isNoNetwork) R.color.backgroundSuccess else R.color.backgroundError)
Expand All @@ -302,7 +296,6 @@ class Apps : AppCompatActivity() {
val hooks = getSet(AppSP.hooks)
filteredData[p].isEnabled = get(AppSP.is_enabled)
filteredData[p].ruleNumbers = hooks.size
filteredData[p].hookTimes = hooks.fold(0) { sum, hash -> sum + getInt("hook_times_$hash", 0) }
}
notifyItemChanged(p)
}
Expand All @@ -318,7 +311,6 @@ class Apps : AppCompatActivity() {
val isFreezed: Boolean,
var isEnabled: Boolean,
var ruleNumbers: Int,
var hookTimes: Int,
)

inner class ViewHolder(view: View): RecyclerView.ViewHolder(view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import com.highcapable.yukihookapi.hook.xposed.prefs.data.PrefsData

object AppSP {
val is_enabled = PrefsData("is_enabled", false)
val hooks = PrefsData("hooks", hashSetOf<String>()) // 哈希去重的 Hook 点集合,以|分隔,并且有多个对应的"hook_entry_$name"、"hook_times_$name"子变量
val hooks = PrefsData("hooks", hashSetOf<String>()) // 哈希去重的 Hook 点集合,以|分隔,并且有多个对应的"hook_entry_$name"子变量
//val "hook_entry_$name" = PrefsData("hook_entry_$name", ListOf<String>()) // 有序的 Hook 参数列表
//val "hook_times_$name" = PrefsData("hook_times_$name", 0) // Hook 成功次数
val vConsole = PrefsData("vConsole", false)
val vConsole_version = PrefsData("vConsole_version", "")
val nebulaUCSDK = PrefsData("nebulaUCSDK", false)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<string name="resources_vconsole_download">下载 vConsole</string>
<string name="resources_vconsole_local">本地版本: %s</string>
<string name="resources_nebulaucsdk_download">下载 UC 调试内核</string>
<string name="applistitem_num">%1$s,配置了 %2$d 条规则,生效了 %3$d 次</string>
<string name="applistitem_num">%1$s,配置了 %2$d 条规则</string>
<string name="apps_show_system_app">显示系统应用</string>
<string name="apps_show_no_network">显示无网络权限</string>
<string name="advance_yuki_version_text">YukiHookAPI 版本: %s(%d)</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<string name="resources_vconsole_download">Download vConsole</string>
<string name="resources_vconsole_local">Local Version: %s</string>
<string name="resources_nebulaucsdk_download">Download NebulaUCSDK</string>
<string name="applistitem_num">%1$s, %2$d rules, hooked %3$d times</string>
<string name="applistitem_num">%1$s, %2$d rules</string>
<string name="apps_show_system_app">Show System Applications</string>
<string name="apps_show_no_network">Show No Network Permission</string>
<string name="advance_yuki_version_text">YukiHookAPI Version: %s(%d)</string>
Expand Down

0 comments on commit 5701485

Please sign in to comment.