mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-13 03:41:19 +08:00
新增隐藏电量百分号
This commit is contained in:
@@ -94,6 +94,12 @@ class SettingsActivity : MIUIActivity() {
|
||||
SwitchV("status_bar_network_speed_refresh_speed")
|
||||
)
|
||||
)
|
||||
add(
|
||||
TextWithSwitchV(
|
||||
TextV(resId = R.string.hide_battery_percentage_icon),
|
||||
SwitchV("hide_battery_percentage_icon")
|
||||
)
|
||||
)
|
||||
add(
|
||||
TextWithSwitchV(
|
||||
TextV(resId = R.string.hide_status_bar_network_speed_second),
|
||||
|
||||
@@ -557,6 +557,35 @@ class SystemUI : IXposedHookLoadPackage {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//隐藏电量百分号
|
||||
try {
|
||||
val classIfExists = XposedHelpers.findClassIfExists(
|
||||
"com.android.systemui.statusbar.views.MiuiBatteryMeterView",
|
||||
lpparam.classLoader
|
||||
)
|
||||
XposedHelpers.findAndHookMethod(
|
||||
classIfExists,
|
||||
"updateResources",
|
||||
object : XC_MethodHook() {
|
||||
override fun afterHookedMethod(param: MethodHookParam) {
|
||||
if (prefs.hasFileChanged()) {
|
||||
prefs.reload()
|
||||
}
|
||||
if (prefs.getBoolean("hide_battery_percentage_icon", false)) {
|
||||
val mBatteryPercentMarkView = XposedHelpers.getObjectField(
|
||||
param.thisObject,
|
||||
"mBatteryPercentMarkView"
|
||||
) as TextView
|
||||
mBatteryPercentMarkView.textSize = 0F
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
} catch (e: Exception) {
|
||||
XposedBridge.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -55,5 +55,6 @@
|
||||
<string name="unlock_unlimited_cropping">解锁无限裁切图片/截图</string>
|
||||
<string name="hide_slave_wifi_icon">隐藏 辅助WIFI 图标</string>
|
||||
<string name="HideLauncherIcon">隐藏桌面图标</string>
|
||||
<string name="hide_battery_percentage_icon">隐藏电量(%)</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user