Revert "合并拉取请求 #233" (#237)

This reverts commit 317340bf6f.
This commit is contained in:
乌堆小透明
2023-03-05 21:07:11 +08:00
committed by GitHub
parent 317340bf6f
commit eb7779ea84

View File

@@ -2,24 +2,22 @@ package com.lt2333.simplicitytools.hooks.rules.t.systemui
import com.github.kyuubiran.ezxhelper.utils.findMethod import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.github.kyuubiran.ezxhelper.utils.putObject
import com.lt2333.simplicitytools.utils.getObjectField
import com.lt2333.simplicitytools.utils.hasEnable import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object HideSimIconForT : HookRegister() { object HideSimIconForT : HookRegister() {
override fun init() { override fun init() {
findMethod("com.android.systemui.statusbar.StatusBarMobileView") { findMethod("com.android.systemui.statusbar.phone.StatusBarSignalPolicy") {
name == "applyMobileState" name == "hasCorrectSubs" && parameterTypes[0] == MutableList::class.java
}.hookBefore { }.hookBefore {
val mobileIconState = it.args[0] val list = it.args[0] as MutableList<*>
val subId = mobileIconState.getObjectField("subId") as Int val size = list.size
hasEnable("hide_sim_one_icon", extraCondition = { subId == 1 }) { hasEnable("hide_sim_two_icon", extraCondition = { size == 2 }) {
mobileIconState.putObject("visible", false) list.removeAt(1)
} }
hasEnable("hide_sim_two_icon", extraCondition = { subId == 2 }) { hasEnable("hide_sim_one_icon", extraCondition = { size >= 1 }) {
mobileIconState.putObject("visible", false) list.removeAt(0)
} }
} }
} }