From ceab4333a38541c062176f243a7d331a9e97f029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=84=95=E6=99=A8HChen?= Date: Sun, 29 Dec 2024 14:48:05 +0800 Subject: [PATCH] opt: Hide focus notifications -> Automate focus notifications --- .../kotlin/statusbar/lyric/config/Config.kt | 6 +++--- .../lyric/hook/module/SystemUILyric.kt | 6 +++--- .../lyric/ui/page/SystemSpecialPage.kt | 18 +++++++++--------- app/src/main/res/values-ja/strings.xml | 2 +- app/src/main/res/values-zh-rCN/strings.xml | 2 +- app/src/main/res/values-zh-rTW/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/src/main/kotlin/statusbar/lyric/config/Config.kt b/app/src/main/kotlin/statusbar/lyric/config/Config.kt index d1a2bc9e..b066f82f 100644 --- a/app/src/main/kotlin/statusbar/lyric/config/Config.kt +++ b/app/src/main/kotlin/statusbar/lyric/config/Config.kt @@ -501,12 +501,12 @@ class Config { set(value) { config.put("viewLocation", value) } - var hideFocusedNotice: Boolean + var automateFocusedNotice: Boolean get() { - return config.opt("hideFocusedNotice", false) + return config.opt("automateFocusedNotice", true) } set(value) { - config.put("hideFocusedNotice", value) + config.put("automateFocusedNotice", value) } private val defIconHashMap by lazy { diff --git a/app/src/main/kotlin/statusbar/lyric/hook/module/SystemUILyric.kt b/app/src/main/kotlin/statusbar/lyric/hook/module/SystemUILyric.kt index 5f739807..8700c7dd 100644 --- a/app/src/main/kotlin/statusbar/lyric/hook/module/SystemUILyric.kt +++ b/app/src/main/kotlin/statusbar/lyric/hook/module/SystemUILyric.kt @@ -461,8 +461,8 @@ class SystemUILyric : BaseHook() { } } - if (config.hideFocusedNotice) { - moduleRes.getString(R.string.hide_focused_notice).log() + if (config.automateFocusedNotice) { + moduleRes.getString(R.string.automate_focused_notice).log() loadClassOrNull("com.android.systemui.statusbar.phone.FocusedNotifPromptController").isNotNull { it.constructorFinder().firstOrNull().ifNotNull { constructor -> constructor.createHook { @@ -567,7 +567,7 @@ class SystemUILyric : BaseHook() { val isInFullscreenMode = defaultDisplay?.getObjectField("isInFullscreenMode") isInFullScreenMode = isInFullscreenMode?.getObjectField("\$\$delegate_0")?.callMethod("getValue") as Boolean - val isTransientShown = defaultDisplay?.getObjectField("isTransientShown"); + val isTransientShown = defaultDisplay?.getObjectField("isTransientShown") statusbarShowing = isTransientShown?.getObjectField("\$\$delegate_0")?.callMethod("getValue") as Boolean } if (isInFullScreenMode) { diff --git a/app/src/main/kotlin/statusbar/lyric/ui/page/SystemSpecialPage.kt b/app/src/main/kotlin/statusbar/lyric/ui/page/SystemSpecialPage.kt index 114fdfae..245ad810 100644 --- a/app/src/main/kotlin/statusbar/lyric/ui/page/SystemSpecialPage.kt +++ b/app/src/main/kotlin/statusbar/lyric/ui/page/SystemSpecialPage.kt @@ -67,7 +67,7 @@ fun SystemSpecialPage(navController: NavController) { val mMiuiPadOptimize = remember { mutableStateOf(config.mMiuiPadOptimize) } val hideCarrier = remember { mutableStateOf(config.hideCarrier) } val mHyperOSTexture = remember { mutableStateOf(config.mHyperOSTexture) } - val mHideFocusedNotice = remember { mutableStateOf(config.hideFocusedNotice) } + val mHideFocusedNotice = remember { mutableStateOf(config.automateFocusedNotice) } val showDialog = remember { mutableStateOf(false) } val showRadioDialog = remember { mutableStateOf(false) } val showCornerDialog = remember { mutableStateOf(false) } @@ -171,6 +171,14 @@ fun SystemSpecialPage(navController: NavController) { .padding(horizontal = 12.dp) .padding(bottom = 6.dp) ) { + SuperSwitch( + title = stringResource(R.string.automate_focused_notice), + checked = mHideFocusedNotice.value, + onCheckedChange = { + mHideFocusedNotice.value = it + config.automateFocusedNotice = it + } + ) SuperSwitch( title = stringResource(R.string.hyperos_texture), checked = mHyperOSTexture.value, @@ -201,14 +209,6 @@ fun SystemSpecialPage(navController: NavController) { ) } } - SuperSwitch( - title = stringResource(R.string.hide_focused_notice), - checked = mHideFocusedNotice.value, - onCheckedChange = { - mHideFocusedNotice.value = it - config.hideFocusedNotice = it - } - ) } } Card( diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index f2253662..f9b48874 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -153,5 +153,5 @@ 設定を消去 設定を消去してもよろしいですか? 歌詞の場所を追加 - フォーカス通知を非表示にする + フォーカス通知の自動処理 diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 5cb2fdfd..6d4f2539 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -153,5 +153,5 @@ 重置配置 确定要重置配置吗? 歌词添加位置 - 隐藏焦点通知 + 自动处理焦点通知 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 72bda498..7b388f84 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -153,5 +153,5 @@ 重設配置 確定要重設配置嗎? 歌詞添加位置 - 隱藏焦點通知 + 自動處理焦點通知 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9713b942..945e2180 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -155,5 +155,5 @@ Clear Config Are you sure you want to clear the configuration? Lyrics add location - Hide focus notifications + Automate focus notifications \ No newline at end of file