mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-12 19:31:17 +08:00
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user