显示 WIFI 角标 (#166)

This commit is contained in:
YuKongA
2022-05-17 00:22:48 +08:00
committed by GitHub
parent 2a94e1da69
commit cef006ced2
6 changed files with 46 additions and 6 deletions

View File

@@ -319,6 +319,10 @@ class SettingsActivity : MIUIActivity() {
dataBindingSend = customMobileTypeTextBinding.bindingSend
)
)
TextWithSwitch(
TextV(resId = R.string.show_wifi_standard),
SwitchV("show_wifi_standard")
)
TextSummaryArrow(
TextSummaryV(
textId = R.string.custom_mobile_type_text

View File

@@ -43,6 +43,7 @@ object SystemUI: AppRegister() {
CustomMobileTypeText, //自定义移动类型文本
CanNotificationSlide, //允许下滑通知打开小窗
LockScreenClockDisplaySeconds, // 锁屏时钟显示秒
ShowWifiStandard, // 显示 WIFI 角标
)
}
}

View File

@@ -0,0 +1,36 @@
package com.lt2333.simplicitytools.hook.app.systemui
import com.github.kyuubiran.ezxhelper.utils.*
import com.lt2333.simplicitytools.util.hasEnable
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
object ShowWifiStandard : HookRegister() {
override fun init() {
findMethod("com.android.systemui.statusbar.StatusBarWifiView") {
name == "initViewState" && parameterCount == 1
}.hookBefore {
hasEnable("show_wifi_standard") {
findMethod("com.android.systemui.statusbar.phone.StatusBarSignalPolicy\$WifiIconState") {
name == "copyTo" && parameterCount == 1
}.hookBefore {
val wifiStandard = it.thisObject.getObjectAs<Int>("wifiStandard")
it.thisObject.putObject("showWifiStandard", wifiStandard != 0)
}
}
}
findMethod("com.android.systemui.statusbar.StatusBarWifiView") {
name == "updateState" && parameterCount == 1
}.hookBefore {
hasEnable("show_wifi_standard") {
findMethod("com.android.systemui.statusbar.phone.StatusBarSignalPolicy\$WifiIconState") {
name == "copyTo" && parameterCount == 1
}.hookBefore {
val wifiStandard = it.thisObject.getObjectAs<Int>("wifiStandard")
it.thisObject.putObject("showWifiStandard", wifiStandard != 0)
}
}
}
}
}

View File

@@ -182,6 +182,7 @@
<string name="left">Left</string>
<string name="right">Right</string>
<string name="big_mobile_type_icon">Big Mobile Type Icon</string>
<string name="show_wifi_standard">Show Wifi Standard</string>
<string name="can_notification_slide">Make most notifications can be slide to small window</string>
<string name="battery_percentage_font_size">Battery percentage font size</string>
<string name="zero_do_no_change">0: do not change</string>