mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-12 11:21:18 +08:00
新增 解除通知图标个数上限
This commit is contained in:
@@ -10,8 +10,8 @@ android {
|
||||
applicationId "com.lt2333.simplicitytools"
|
||||
minSdk 30
|
||||
targetSdk 32
|
||||
versionCode 6
|
||||
versionName '1.0.5'
|
||||
versionCode 8
|
||||
versionName '1.0.7'
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
@@ -377,24 +377,48 @@ class SystemUI : IXposedHookLoadPackage {
|
||||
|
||||
}
|
||||
//通知图标上限
|
||||
try {
|
||||
val classIfExists = XposedHelpers.findClassIfExists(
|
||||
"com.android.systemui.statusbar.phone.NotificationIconContainer",
|
||||
lpparam.classLoader
|
||||
)
|
||||
XposedHelpers.findAndHookMethod(
|
||||
classIfExists,
|
||||
"miuiShowNotificationIcons",
|
||||
Boolean::class.java,
|
||||
object : XC_MethodHook() {
|
||||
override fun beforeHookedMethod(param: MethodHookParam) {
|
||||
|
||||
}
|
||||
})
|
||||
} catch (e: Exception) {
|
||||
XposedBridge.log(e)
|
||||
if (prefs.hasFileChanged()) {
|
||||
prefs.reload()
|
||||
}
|
||||
if (prefs.getBoolean("remove_the_maximum_number_of_notification_icons", false)) {
|
||||
try {
|
||||
val classIfExists = XposedHelpers.findClassIfExists(
|
||||
"com.android.systemui.statusbar.phone.NotificationIconContainer",
|
||||
lpparam.classLoader
|
||||
)
|
||||
XposedHelpers.findAndHookMethod(
|
||||
classIfExists,
|
||||
"miuiShowNotificationIcons",
|
||||
Boolean::class.java,
|
||||
object : XC_MethodReplacement() {
|
||||
override fun replaceHookedMethod(param: MethodHookParam) {
|
||||
|
||||
if (param.args[0] as Boolean) {
|
||||
XposedHelpers.setIntField(param.thisObject, "MAX_DOTS", 30)
|
||||
XposedHelpers.setIntField(param.thisObject, "MAX_STATIC_ICONS", 30)
|
||||
XposedHelpers.setIntField(
|
||||
param.thisObject,
|
||||
"MAX_VISIBLE_ICONS_ON_LOCK",
|
||||
30
|
||||
)
|
||||
} else {
|
||||
XposedHelpers.setIntField(param.thisObject, "MAX_DOTS", 0)
|
||||
XposedHelpers.setIntField(param.thisObject, "MAX_STATIC_ICONS", 0)
|
||||
XposedHelpers.setIntField(
|
||||
param.thisObject,
|
||||
"MAX_VISIBLE_ICONS_ON_LOCK",
|
||||
0
|
||||
)
|
||||
}
|
||||
|
||||
XposedHelpers.callMethod(param.thisObject, "updateState")
|
||||
}
|
||||
})
|
||||
} catch (e: Exception) {
|
||||
XposedBridge.log(e)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,5 +45,6 @@
|
||||
<string name="statusbar">状态栏(重启系统界面生效)</string>
|
||||
<string name="status_bar_time_seconds">时钟显秒</string>
|
||||
<string name="status_bar_network_speed_refresh_speed">网速秒刷新</string>
|
||||
<string name="remove_the_maximum_number_of_notification_icons">解除通知图标个数上限</string>
|
||||
|
||||
</resources>
|
||||
@@ -1,5 +1,4 @@
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<PreferenceCategory
|
||||
app:iconSpaceReserved="false"
|
||||
@@ -21,6 +20,10 @@
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="status_bar_network_speed_refresh_speed"
|
||||
app:title="@string/status_bar_network_speed_refresh_speed" />
|
||||
<SwitchPreference
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="remove_the_maximum_number_of_notification_icons"
|
||||
app:title="@string/remove_the_maximum_number_of_notification_icons" />
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user