mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-13 03:41:19 +08:00
更新10个系统界面Hooker
This commit is contained in:
@@ -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<ImageView>()?.visibility = View.GONE
|
||||||
|
if (instance.current().field { name = "mBatteryStyle" }.int() == 1) {
|
||||||
|
instance.current().field { name = "mBatteryDigitalView" }.cast<FrameLayout>()?.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//隐藏电池内的百分比
|
||||||
|
hasEnable("hide_battery_percentage_icon") {
|
||||||
|
instance.current().field { name = "mBatteryPercentMarkView" }.cast<TextView>()?.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<ImageView>()?.visibility = View.GONE
|
||||||
|
instance.current().field { name = "mBatteryChargingView" }.cast<ImageView>()?.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<ImageView>()?.visibility = View.GONE
|
||||||
|
}
|
||||||
|
hasEnable("hide_small_hd_icon") {
|
||||||
|
it.instance.current().field {name = "mSmallHd" }.cast<ImageView>()?.visibility = View.GONE
|
||||||
|
}
|
||||||
|
hasEnable("hide_hd_no_service_icon") {
|
||||||
|
it.instance.current().field {name = "mVolteNoService" }.cast<ImageView>()?.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<ImageView>()?.visibility = View.GONE
|
||||||
|
it.instance.current().field { name = "mRightInOut" }.cast<ImageView>()?.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<ImageView>()?.visibility = View.GONE
|
||||||
|
it.instance.current().field { name = "mMobileTypeImage" }.cast<ImageView>()?.visibility = View.GONE
|
||||||
|
it.instance.current().field { name = "mMobileTypeSingle" }.cast<ImageView>()?.visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
it.instance.current().field { name = "mMobileType" }.cast<ImageView>()?.visibility = View.INVISIBLE
|
||||||
|
it.instance.current().field { name = "mMobileTypeImage" }.cast<ImageView>()?.visibility = View.INVISIBLE
|
||||||
|
it.instance.current().field { name = "mMobileTypeSingle" }.cast<ImageView>()?.visibility = View.INVISIBLE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<ImageView>()?.visibility = View.INVISIBLE
|
||||||
|
}
|
||||||
|
//隐藏WIFI标准图标
|
||||||
|
hasEnable("hide_wifi_standard_icon") {
|
||||||
|
it.instance.current().field { name = "mWifiStandardView" }.cast<TextView>()?.visibility = View.INVISIBLE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user