新增自定义通知图标上限

This commit is contained in:
LittleTurtle2333
2022-03-29 16:43:25 +08:00
parent 657c65164f
commit b29bfb45f9
4 changed files with 18 additions and 17 deletions

View File

@@ -919,12 +919,16 @@ class SettingsActivity : MIUIActivity() {
) )
) )
add( add(
TextSummaryWithSwitchV( TextV(
TextSummaryV( resId = R.string.maximum_number_of_notification_icons
textId = R.string.remove_the_maximum_number_of_notification_icons, )
tipsId = R.string.remove_the_maximum_number_of_notification_icons_summary )
), add(
SwitchV("remove_the_maximum_number_of_notification_icons") SeekBarWithTextV(
"maximum_number_of_notification_icons",
1,
30,
3
) )
) )
add( add(

View File

@@ -21,7 +21,7 @@ object SystemUI: AppRegister() {
HideMobileTypeIcon, //隐藏移动类型图标 HideMobileTypeIcon, //隐藏移动类型图标
HideStatusBarNetworkSpeedSecond, //隐藏状态栏网速/s HideStatusBarNetworkSpeedSecond, //隐藏状态栏网速/s
HideWifiActivityIcon, //隐藏WIFI活动箭头图标 HideWifiActivityIcon, //隐藏WIFI活动箭头图标
RemoveTheMaximumNumberOfNotificationIcons, //移除通知图标上限 MaximumNumberOfNotificationIcons, //通知图标上限
StatusBarNetworkSpeedRefreshSpeed, //状态栏网速秒刷新 StatusBarNetworkSpeedRefreshSpeed, //状态栏网速秒刷新
StatusBarTimeCustomization, //状态栏时钟自定义 StatusBarTimeCustomization, //状态栏时钟自定义
RemoveTheLeftSideOfTheLockScreen, //移除锁屏负一屏功能 RemoveTheLeftSideOfTheLockScreen, //移除锁屏负一屏功能

View File

@@ -1,20 +1,17 @@
package com.lt2333.simplicitytools.hook.app.systemui package com.lt2333.simplicitytools.hook.app.systemui
import com.lt2333.simplicitytools.util.callMethod import com.lt2333.simplicitytools.util.*
import com.lt2333.simplicitytools.util.hasEnable
import com.lt2333.simplicitytools.util.replaceMethod
import com.lt2333.simplicitytools.util.setIntField
import com.lt2333.simplicitytools.util.xposed.base.HookRegister import com.lt2333.simplicitytools.util.xposed.base.HookRegister
object RemoveTheMaximumNumberOfNotificationIcons: HookRegister() { object MaximumNumberOfNotificationIcons: HookRegister() {
override fun init() { override fun init() {
hasEnable("remove_the_maximum_number_of_notification_icons") { val size = XSPUtils.getInt("maximum_number_of_notification_icons",3)
"com.android.systemui.statusbar.phone.NotificationIconContainer".replaceMethod(getDefaultClassLoader(), "miuiShowNotificationIcons", Boolean::class.java) { "com.android.systemui.statusbar.phone.NotificationIconContainer".replaceMethod(getDefaultClassLoader(), "miuiShowNotificationIcons", Boolean::class.java) {
if (it.args[0] as Boolean) { if (it.args[0] as Boolean) {
it.thisObject.setIntField("MAX_DOTS", 30) it.thisObject.setIntField("MAX_DOTS", size)
it.thisObject.setIntField("MAX_STATIC_ICONS", 30) it.thisObject.setIntField("MAX_STATIC_ICONS", size)
it.thisObject.setIntField("MAX_VISIBLE_ICONS_ON_LOCK", 30) it.thisObject.setIntField("MAX_VISIBLE_ICONS_ON_LOCK", size)
} else { } else {
it.thisObject.setIntField("MAX_DOTS", 0) it.thisObject.setIntField("MAX_DOTS", 0)
it.thisObject.setIntField("MAX_STATIC_ICONS", 0) it.thisObject.setIntField("MAX_STATIC_ICONS", 0)
@@ -22,7 +19,6 @@ object RemoveTheMaximumNumberOfNotificationIcons: HookRegister() {
} }
it.thisObject.callMethod("updateState") it.thisObject.callMethod("updateState")
} }
}
} }
} }

View File

@@ -198,4 +198,5 @@
<string name="clock_right">Clock Right</string> <string name="clock_right">Clock Right</string>
<string name="status_bar_layout_mode">Status bar layout mode</string> <string name="status_bar_layout_mode">Status bar layout mode</string>
<string name="clock_center_and_icon_left">Clock Center and Icon Left</string> <string name="clock_center_and_icon_left">Clock Center and Icon Left</string>
<string name="maximum_number_of_notification_icons">Maximum number of notification icons</string>
</resources> </resources>