From 0e08a2810c985951c14b8ea38136770907840a66 Mon Sep 17 00:00:00 2001 From: Art_Chen Date: Tue, 20 Aug 2024 23:11:22 +0800 Subject: [PATCH] WallpaperDarkenDisabler: split home text shadow feature toggle Signed-off-by: Art_Chen --- .../miuiextra/hooker/entity/home/IconLaunchAnimHooker.kt | 2 +- .../miuiextra/hooker/entity/home/TitleShadowHooker.kt | 2 +- .../moe/chenxy/miuiextra/view/activity/SettingsActivity.kt | 5 +++-- app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + app/src/main/res/xml/chen_preferences.xml | 7 ++++++- 7 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/moe/chenxy/miuiextra/hooker/entity/home/IconLaunchAnimHooker.kt b/app/src/main/java/moe/chenxy/miuiextra/hooker/entity/home/IconLaunchAnimHooker.kt index 95d9002..8ed0165 100644 --- a/app/src/main/java/moe/chenxy/miuiextra/hooker/entity/home/IconLaunchAnimHooker.kt +++ b/app/src/main/java/moe/chenxy/miuiextra/hooker/entity/home/IconLaunchAnimHooker.kt @@ -84,7 +84,7 @@ object IconLaunchAnimHooker : YukiBaseHooker() { // Don't run PerformClickRunnable early "com.miui.home.launcher.ItemIcon".toClass().method { - name = "initPerformClickRunnable" + name = "initPerformClickRunnable" }.hook { replaceUnit { XposedHelpers.setObjectField(instance, "mPerformClickRunnable", mRunnable) diff --git a/app/src/main/java/moe/chenxy/miuiextra/hooker/entity/home/TitleShadowHooker.kt b/app/src/main/java/moe/chenxy/miuiextra/hooker/entity/home/TitleShadowHooker.kt index d348cdd..507075e 100644 --- a/app/src/main/java/moe/chenxy/miuiextra/hooker/entity/home/TitleShadowHooker.kt +++ b/app/src/main/java/moe/chenxy/miuiextra/hooker/entity/home/TitleShadowHooker.kt @@ -13,7 +13,7 @@ import kotlin.math.abs object TitleShadowHooker : YukiBaseHooker() { override fun onHook() { - val enableShadow = mainPrefs.getBoolean("disable_wallpaper_auto_darken", false) + val enableShadow = mainPrefs.getBoolean("disable_wallpaper_auto_darken", false) && mainPrefs.getBoolean("enable_home_text_shadow", false) "com.miui.home.launcher.DeviceConfig".toClass().apply { method { name = "checkDarkenWallpaperSupport" diff --git a/app/src/main/java/moe/chenxy/miuiextra/view/activity/SettingsActivity.kt b/app/src/main/java/moe/chenxy/miuiextra/view/activity/SettingsActivity.kt index c83f595..380cf70 100644 --- a/app/src/main/java/moe/chenxy/miuiextra/view/activity/SettingsActivity.kt +++ b/app/src/main/java/moe/chenxy/miuiextra/view/activity/SettingsActivity.kt @@ -114,7 +114,8 @@ class SettingsActivity : AppCompatActivity() { override fun onPreferenceTreeClick(preference: Preference): Boolean { if (preference is TwoStatePreference) { when (preference.key) { - "override_linkage_wallpaper_anim", "disable_wallpaper_auto_darken" -> { + "override_linkage_wallpaper_anim", "enable_home_text_shadow" -> { + this.context?.let { ChenUtils.performVibrateHeavyClick(it) } return true } } @@ -199,7 +200,7 @@ class SettingsActivity : AppCompatActivity() { return@setOnPreferenceChangeListener true } - findPreference("disable_wallpaper_auto_darken")?.setOnPreferenceChangeListener { _, _ -> + findPreference("enable_home_text_shadow")?.setOnPreferenceChangeListener { _, _ -> // MiuiHome use this feature toggle to inject hook when on load, Wallpaper app check this feature toggle on every call showRebootSnackBar(null, SHELL_RESTART_MIUI_HOME) return@setOnPreferenceChangeListener true diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index d390e1d..2ee0da4 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -247,4 +247,5 @@ This will also add a beautiful text shadow on miui home icon title to enhance text visibility Lineage Aod and Chen Wallpaper Anim WARNING: May cause screen burn if AOD Always mode + Enable Home Text Shadow diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 905e799..42fbfc4 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -134,4 +134,5 @@ 覆盖联动息屏壁纸动画参数 联动息屏和琛的壁纸动画 警告:长亮AOD时有烧屏风险 + 启用桌面文字阴影效果 \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a95fecf..4101bf0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -136,4 +136,5 @@ This will also add a beautiful text shadow on miui home icon title to enhance text visibility Lineage Aod and Chen Wallpaper Anim WARNING: May cause screen burn if AOD Always mode + Enable Home Text Shadow \ No newline at end of file diff --git a/app/src/main/res/xml/chen_preferences.xml b/app/src/main/res/xml/chen_preferences.xml index c8ee0c7..e2c0922 100644 --- a/app/src/main/res/xml/chen_preferences.xml +++ b/app/src/main/res/xml/chen_preferences.xml @@ -112,7 +112,12 @@ + +