新增自定义状态栏通知最大点数

This commit is contained in:
LittleTurtle2333
2022-03-31 17:12:53 +08:00
parent daa3c02d1a
commit 5e35cfb3e3
3 changed files with 19 additions and 4 deletions

View File

@@ -931,6 +931,19 @@ class SettingsActivity : MIUIActivity() {
3 3
) )
) )
add(
TextV(
resId = R.string.maximum_number_of_notification_dots
)
)
add(
SeekBarWithTextV(
"maximum_number_of_notification_dots",
0,
4,
3
)
)
add( add(
TextSummaryArrowV( TextSummaryArrowV(
TextSummaryV( TextSummaryV(

View File

@@ -6,12 +6,13 @@ import com.lt2333.simplicitytools.util.xposed.base.HookRegister
object MaximumNumberOfNotificationIcons: HookRegister() { object MaximumNumberOfNotificationIcons: HookRegister() {
override fun init() { override fun init() {
val size = XSPUtils.getInt("maximum_number_of_notification_icons",3) val icons = XSPUtils.getInt("maximum_number_of_notification_icons",3)
val dots = XSPUtils.getInt("maximum_number_of_notification_dots",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", size) it.thisObject.setIntField("MAX_DOTS", dots)
it.thisObject.setIntField("MAX_STATIC_ICONS", size) it.thisObject.setIntField("MAX_STATIC_ICONS", icons)
it.thisObject.setIntField("MAX_VISIBLE_ICONS_ON_LOCK", size) it.thisObject.setIntField("MAX_VISIBLE_ICONS_ON_LOCK", icons)
} 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)

View File

@@ -199,4 +199,5 @@
<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> <string name="maximum_number_of_notification_icons">Maximum number of notification icons</string>
<string name="maximum_number_of_notification_dots">Maximum number of notification dots</string>
</resources> </resources>