Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt: Hide focus notifications -> Automate focus notifications #505

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/src/main/kotlin/statusbar/lyric/config/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/kotlin/statusbar/lyric/ui/page/SystemSpecialPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,5 @@
<string name="clear_config">設定を消去</string>
<string name="clear_config_tips">設定を消去してもよろしいですか?</string>
<string name="view_location">歌詞の場所を追加</string>
<string name="hide_focused_notice">フォーカス通知を非表示にする</string>
<string name="automate_focused_notice">フォーカス通知の自動処理</string>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,5 @@
<string name="clear_config">重置配置</string>
<string name="clear_config_tips">确定要重置配置吗?</string>
<string name="view_location">歌词添加位置</string>
<string name="hide_focused_notice">隐藏焦点通知</string>
<string name="automate_focused_notice">自动处理焦点通知</string>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,5 @@
<string name="clear_config">重設配置</string>
<string name="clear_config_tips">確定要重設配置嗎?</string>
<string name="view_location">歌詞添加位置</string>
<string name="hide_focused_notice">隱藏焦點通知</string>
<string name="automate_focused_notice">自動處理焦點通知</string>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,5 @@
<string name="clear_config">Clear Config</string>
<string name="clear_config_tips">Are you sure you want to clear the configuration?</string>
<string name="view_location">Lyrics add location</string>
<string name="hide_focused_notice">Hide focus notifications</string>
<string name="automate_focused_notice">Automate focus notifications</string>
</resources>
Loading