新增隐藏电量百分号

This commit is contained in:
LittleTurtle2333
2022-02-20 19:40:06 +08:00
parent 53a2ffd8de
commit 6af667bb86
4 changed files with 38 additions and 2 deletions

View File

@@ -12,8 +12,8 @@ android {
applicationId = "com.lt2333.simplicitytools" applicationId = "com.lt2333.simplicitytools"
minSdk = 30 minSdk = 30
targetSdk = 32 targetSdk = 32
versionCode = 15 versionCode = 16
versionName = "1.1.4" versionName = "1.1.5"
} }
buildTypes { buildTypes {

View File

@@ -94,6 +94,12 @@ class SettingsActivity : MIUIActivity() {
SwitchV("status_bar_network_speed_refresh_speed") SwitchV("status_bar_network_speed_refresh_speed")
) )
) )
add(
TextWithSwitchV(
TextV(resId = R.string.hide_battery_percentage_icon),
SwitchV("hide_battery_percentage_icon")
)
)
add( add(
TextWithSwitchV( TextWithSwitchV(
TextV(resId = R.string.hide_status_bar_network_speed_second), TextV(resId = R.string.hide_status_bar_network_speed_second),

View File

@@ -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)
}
} }
} }

View File

@@ -55,5 +55,6 @@
<string name="unlock_unlimited_cropping">解锁无限裁切图片/截图</string> <string name="unlock_unlimited_cropping">解锁无限裁切图片/截图</string>
<string name="hide_slave_wifi_icon">隐藏 辅助WIFI 图标</string> <string name="hide_slave_wifi_icon">隐藏 辅助WIFI 图标</string>
<string name="HideLauncherIcon">隐藏桌面图标</string> <string name="HideLauncherIcon">隐藏桌面图标</string>
<string name="hide_battery_percentage_icon">隐藏电量(%</string>
</resources> </resources>