diff --git a/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideBatteryIconForT.kt b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideBatteryIconForT.kt new file mode 100644 index 00000000..713b2d65 --- /dev/null +++ b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideBatteryIconForT.kt @@ -0,0 +1,50 @@ +package com.lt2333.simplicitytools.hooks.rules.t.systemui + +import android.view.View +import android.view.ViewGroup +import android.widget.FrameLayout +import android.widget.ImageView +import android.widget.TextView +import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker +import com.highcapable.yukihookapi.hook.factory.current +import com.lt2333.simplicitytools.utils.hasEnable + +object HideBatteryIconForT : YukiBaseHooker() { + override fun onHook() { + + "com.android.systemui.statusbar.views.MiuiBatteryMeterView".hook { + injectMember { + method { name = "updateResources" } + afterHook { + //隐藏电池图标 + hasEnable("hide_battery_icon") { + instance.current().field { name = "mBatteryStyle" }.cast()?.visibility = View.GONE + if (instance.current().field { name = "mBatteryStyle" }.int() == 1) { + instance.current().field { name = "mBatteryDigitalView" }.cast()?.visibility = View.GONE + } + } + //隐藏电池内的百分比 + hasEnable("hide_battery_percentage_icon") { + instance.current().field { name = "mBatteryPercentMarkView" }.cast()?.textSize=0F + } + + "com.android.systemui.statusbar.views.MiuiBatteryMeterView".hook { + injectMember { + method { + name = "updateChargeAndText" + } + afterHook { + //隐藏电池充电图标 + hasEnable("hide_battery_charging_icon") { + instance.current().field { name = "mBatteryChargingInView" }.cast()?.visibility = View.GONE + instance.current().field { name = "mBatteryChargingView" }.cast()?.visibility = View.GONE + } + } + } + } + } + } + + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideHDIconForT.kt b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideHDIconForT.kt new file mode 100644 index 00000000..c01ab0b1 --- /dev/null +++ b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideHDIconForT.kt @@ -0,0 +1,54 @@ +package com.lt2333.simplicitytools.hooks.rules.t.systemui + +import android.view.View +import android.widget.ImageView +import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker +import com.highcapable.yukihookapi.hook.factory.current +import com.highcapable.yukihookapi.hook.param.HookParam +import com.lt2333.simplicitytools.utils.hasEnable + +object HideHDIconForT : YukiBaseHooker() { + override fun onHook() { + "com.android.systemui.statusbar.StatusBarMobileView".hook { + injectMember { + method { + name = "initViewState" + paramCount = 1 + } + afterHook { + hide(this) + } + } + injectMember { + method { + name = "updateState" + paramCount = 1 + } + afterHook { + hide(this) + } + } + } + hasEnable("hide_new_hd_icon") { + "com.android.systemui.statusbar.policy.HDController".hook { + injectMember { + method { name = "update" } + beforeHook { + this.result = null + } + } + } + } + } + private fun hide(it: HookParam) { + hasEnable("hide_big_hd_icon") { + it.instance.current().field {name = "mVolte" }.cast()?.visibility = View.GONE + } + hasEnable("hide_small_hd_icon") { + it.instance.current().field {name = "mSmallHd" }.cast()?.visibility = View.GONE + } + hasEnable("hide_hd_no_service_icon") { + it.instance.current().field {name = "mVolteNoService" }.cast()?.visibility = View.GONE + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideMobileActivityIconForT.kt b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideMobileActivityIconForT.kt new file mode 100644 index 00000000..e8035ae7 --- /dev/null +++ b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideMobileActivityIconForT.kt @@ -0,0 +1,43 @@ +package com.lt2333.simplicitytools.hooks.rules.t.systemui + +import android.view.View +import android.widget.ImageView +import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker +import com.highcapable.yukihookapi.hook.factory.current +import com.highcapable.yukihookapi.hook.param.HookParam +import com.lt2333.simplicitytools.utils.hasEnable + +object HideMobileActivityIconForT : YukiBaseHooker() { + override fun onHook() { + "com.android.systemui.statusbar.StatusBarMobileView".hook { + injectMember { + method { + name = "initViewState" + paramCount = 1 + } + afterHook { + hide(this) + } + } + } + + "com.android.systemui.statusbar.StatusBarMobileView".hook { + injectMember { + method { + name = "updateState" + paramCount = 1 + } + afterHook { + hide(this) + } + } + } + } + + private fun hide(it: HookParam) { + hasEnable("hide_mobile_activity_icon") { + it.instance.current().field { name = "mLeftInOut" }.cast()?.visibility = View.GONE + it.instance.current().field { name = "mRightInOut" }.cast()?.visibility = View.GONE + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideMobileTypeIconForT.kt b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideMobileTypeIconForT.kt new file mode 100644 index 00000000..59adc91b --- /dev/null +++ b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideMobileTypeIconForT.kt @@ -0,0 +1,54 @@ +package com.lt2333.simplicitytools.hooks.rules.t.systemui + +import android.view.View +import android.widget.ImageView +import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker +import com.highcapable.yukihookapi.hook.factory.current +import com.highcapable.yukihookapi.hook.param.HookParam +import com.lt2333.simplicitytools.utils.XSPUtils +import com.lt2333.simplicitytools.utils.hasEnable + +object HideMobileTypeIconForT : YukiBaseHooker() { + + private val isBigType = XSPUtils.getBoolean("big_mobile_type_icon", false) + + override fun onHook() { + "com.android.systemui.statusbar.StatusBarMobileView".hook { + injectMember { + method { + name = "initViewState" + paramCount = 1 + } + afterHook { + hideMobileTypeIcon(this) + } + } + } + + "com.android.systemui.statusbar.StatusBarMobileView".hook { + injectMember { + method { + name = "updateState" + paramCount = 1 + } + afterHook { + hideMobileTypeIcon(this) + } + } + } + } + + private fun hideMobileTypeIcon(it: HookParam) { + hasEnable("hide_mobile_type_icon") { + if (isBigType) { + it.instance.current().field { name = "mMobileType" }.cast()?.visibility = View.GONE + it.instance.current().field { name = "mMobileTypeImage" }.cast()?.visibility = View.GONE + it.instance.current().field { name = "mMobileTypeSingle" }.cast()?.visibility = View.GONE + } else { + it.instance.current().field { name = "mMobileType" }.cast()?.visibility = View.INVISIBLE + it.instance.current().field { name = "mMobileTypeImage" }.cast()?.visibility = View.INVISIBLE + it.instance.current().field { name = "mMobileTypeSingle" }.cast()?.visibility = View.INVISIBLE + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideSimIconForT.kt b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideSimIconForT.kt new file mode 100644 index 00000000..8abc4369 --- /dev/null +++ b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideSimIconForT.kt @@ -0,0 +1,28 @@ +package com.lt2333.simplicitytools.hooks.rules.t.systemui + +import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker +import com.lt2333.simplicitytools.utils.hasEnable + +object HideSimIconForT:YukiBaseHooker() { + override fun onHook() { + "com.android.systemui.statusbar.phone.StatusBarSignalPolicy".hook { + injectMember { + method { + name = "hasCorrectSubs" + param(MutableList::class.java) + } + beforeHook { + val list = this.args[0] as MutableList<*> + val size = list.size + hasEnable("hide_sim_two_icon", extraCondition = { size == 2 }) { + list.removeAt(1) + } + hasEnable("hide_sim_one_icon", extraCondition = { size >= 1 }) { + list.removeAt(0) + } + } + } + } + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideStatusBarIconForT.kt b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideStatusBarIconForT.kt new file mode 100644 index 00000000..c4fa0df7 --- /dev/null +++ b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideStatusBarIconForT.kt @@ -0,0 +1,94 @@ +package com.lt2333.simplicitytools.hooks.rules.t.systemui + +import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker +import com.highcapable.yukihookapi.hook.param.HookParam +import com.lt2333.simplicitytools.utils.hasEnable + +object HideStatusBarIconForT : YukiBaseHooker() { + override fun onHook() { + "com.android.systemui.statusbar.phone.StatusBarIconControllerImpl".hook { + injectMember { + method { + name = "setIconVisibility" + paramCount = 2 + } + beforeHook { + hideIcon(this) + } + } + } + + "com.android.systemui.statusbar.phone.MiuiDripLeftStatusBarIconControllerImpl".hook { + injectMember { + method { + name = "setIconVisibility" + paramCount = 2 + } + beforeHook { + hideIcon(this) + } + } + } + } + private fun hideIcon(it: HookParam) { + //Log.d("图标名字", "handleLoadPackage: " + it.args[0]) + when (it.args[0] as String) { + //隐藏蓝牙 + "bluetooth" -> hasEnable("hide_bluetooth_icon") { + it.args[1] = false + } + //隐藏蓝牙电量 + "bluetooth_handsfree_battery" -> hasEnable("hide_bluetooth_battery_icon") { + it.args[1] = false + } + //隐藏勿扰 + "zen" -> hasEnable("hide_zen_icon") { + it.args[1] = false + } + //隐藏声音 + "volume" -> hasEnable("hide_volume_icon") { + it.args[1] = false + } + //隐藏WIFI + "wifi" -> hasEnable("hide_wifi_icon") { + it.args[1] = false + } + //隐藏WIFI辅助 + "slave_wifi" -> hasEnable("hide_slave_wifi_icon") { + it.args[1] = false + } + //隐藏飞行模式 + "airplane" -> hasEnable("hide_airplane_icon") { + it.args[1] = false + } + //隐藏闹钟 + "alarm_clock" -> hasEnable("hide_alarm_icon") { + it.args[1] = false + } + //隐藏定位 + "location" -> hasEnable("hide_gps_icon") { + it.args[1] = false + } + //隐藏热点 + "hotspot" -> hasEnable("hide_hotspot_icon") { + it.args[1] = false + } + //隐藏耳机 + "headset" -> hasEnable("hide_headset_icon") { + it.args[1] = false + } + //隐藏VPN + "vpn" -> hasEnable("hide_vpn_icon") { + it.args[1] = false + } + //隐藏无SIM卡 + "no_sim" -> hasEnable("hide_no_sim_icon") { + it.args[1] = false + } + //隐藏NFC图标 + "nfc" -> hasEnable("hide_nfc_icon") { + it.args[1] = false + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideStatusBarNetworkSpeedSecondForT.kt b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideStatusBarNetworkSpeedSecondForT.kt new file mode 100644 index 00000000..c9ede8d4 --- /dev/null +++ b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideStatusBarNetworkSpeedSecondForT.kt @@ -0,0 +1,29 @@ +package com.lt2333.simplicitytools.hooks.rules.t.systemui + +import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker +import com.lt2333.simplicitytools.utils.hasEnable + +object HideStatusBarNetworkSpeedSecondForT : YukiBaseHooker() { + override fun onHook() { + "com.android.systemui.statusbar.views.NetworkSpeedView".hook { + injectMember { + method { + name = "setNetworkSpeed" + paramCount = 1 + } + beforeHook { + hasEnable("hide_status_bar_network_speed_second") { + if (this.args[0] != null) { + val mText = (this.args[0] as String) + .replace("/", "") + .replace("s", "") + .replace("\'", "") + .replace("วิ", "") + this.args[0] = mText + } + } + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideWifiActivityIconForT.kt b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideWifiActivityIconForT.kt new file mode 100644 index 00000000..c414f35d --- /dev/null +++ b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/HideWifiActivityIconForT.kt @@ -0,0 +1,46 @@ +package com.lt2333.simplicitytools.hooks.rules.t.systemui + +import android.view.View +import android.widget.ImageView +import android.widget.TextView +import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker +import com.highcapable.yukihookapi.hook.factory.current +import com.highcapable.yukihookapi.hook.param.HookParam +import com.lt2333.simplicitytools.utils.hasEnable + +object HideWifiActivityIconForT: YukiBaseHooker() { + override fun onHook() { + "com.android.systemui.statusbar.StatusBarWifiView".hook { + injectMember { + method { + name = "initViewState" + paramCount = 1 + } + afterHook { + hide(this) + } + } + } + "com.android.systemui.statusbar.StatusBarWifiView".hook { + injectMember { + method { + name = "updateState" + paramCount = 1 + } + afterHook { + hide(this) + } + } + } + } + private fun hide(it: HookParam) { + //隐藏WIFI箭头 + hasEnable("hide_wifi_activity_icon") { + it.instance.current().field { name = "mWifiActivityView" }.cast()?.visibility = View.INVISIBLE + } + //隐藏WIFI标准图标 + hasEnable("hide_wifi_standard_icon") { + it.instance.current().field { name = "mWifiStandardView" }.cast()?.visibility = View.INVISIBLE + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/MaximumNumberOfNotificationIconsForT.kt b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/MaximumNumberOfNotificationIconsForT.kt new file mode 100644 index 00000000..07e0677d --- /dev/null +++ b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/MaximumNumberOfNotificationIconsForT.kt @@ -0,0 +1,33 @@ +package com.lt2333.simplicitytools.hooks.rules.t.systemui + +import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker +import com.highcapable.yukihookapi.hook.factory.current +import com.lt2333.simplicitytools.utils.XSPUtils +import java.lang.reflect.Method + +object MaximumNumberOfNotificationIconsForT: YukiBaseHooker() { + override fun onHook() { + val icons = XSPUtils.getInt("maximum_number_of_notification_icons", 3) + val dots = XSPUtils.getInt("maximum_number_of_notification_dots", 3) + "com.android.systemui.statusbar.phone.NotificationIconContainer".hook { + injectMember { + method { + name = "miuiShowNotificationIcons" + paramCount = 1 + } + replaceUnit { + if (this.args[0] as Boolean) { + instance.current().field { name = "MAX_DOTS" }.set(dots) + instance.current().field { name = "MAX_STATIC_ICONS" }.set(icons) + instance.current().field { name = "MAX_VISIBLE_ICONS_ON_LOCK" }.set(icons) + } else { + instance.current().field { name = "MAX_DOTS" }.set(0) + instance.current().field { name = "MAX_STATIC_ICONS" }.set(0) + instance.current().field { name = "MAX_VISIBLE_ICONS_ON_LOCK" }.set(0) + } + instance.current().method { name = "updateState" }.call() + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/StatusBarNetworkSpeedRefreshSpeedForT.kt b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/StatusBarNetworkSpeedRefreshSpeedForT.kt new file mode 100644 index 00000000..705a9ba5 --- /dev/null +++ b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/StatusBarNetworkSpeedRefreshSpeedForT.kt @@ -0,0 +1,22 @@ +package com.lt2333.simplicitytools.hooks.rules.t.systemui + +import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker +import com.lt2333.simplicitytools.utils.hasEnable + +object StatusBarNetworkSpeedRefreshSpeedForT : YukiBaseHooker() { + override fun onHook() { + "com.android.systemui.statusbar.policy.NetworkSpeedController".hook { + injectMember { + method { + name = "postUpdateNetworkSpeedDelay" + param { it[0] == Long::class.java } + } + beforeHook { + hasEnable("status_bar_network_speed_refresh_speed") { + this.args[0] = 1000L + } + } + } + } + } +} \ No newline at end of file