diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/BlurSecurity.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/BlurSecurity.kt index 94468ab937..9cfa3128d3 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/BlurSecurity.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/BlurSecurity.kt @@ -30,6 +30,7 @@ import de.robv.android.xposed.XposedHelpers object BlurSecurity : BaseHook() { val blurRadius = mPrefsMap.getInt("security_center_blurradius", 60) val backgroundColor = mPrefsMap.getInt("security_center_color", -1) + val isInvertColor = mPrefsMap.getBoolean("security_center_invert_color") val shouldInvertColor = !ColorUtils.isDarkColor(backgroundColor) private var appVersionCode = 40000727 @@ -79,7 +80,6 @@ object BlurSecurity : BaseHook() { view.addOnAttachStateChangeListener( object : View.OnAttachStateChangeListener { - @RequiresApi(Build.VERSION_CODES.S) override fun onViewAttachedToWindow(view: View) { // 已有背景 避免重复添加 @@ -119,7 +119,7 @@ object BlurSecurity : BaseHook() { HookUtils.createBlurDrawable(gameContentLayout, blurRadius, 40, backgroundColor) if (shouldInvertColor) { - invertViewColor(gameContentLayout) + if (isInvertColor) invertViewColor(gameContentLayout) // 设置 RenderEffect 后会导致文字动画出现问题,故去除动画 val performanceTextView = XposedHelpers.callMethod( @@ -181,7 +181,7 @@ object BlurSecurity : BaseHook() { view.background = HookUtils.createBlurDrawable(view, blurRadius, 40, backgroundColor) - if (shouldInvertColor) invertViewColor(mainContent) + if (shouldInvertColor && isInvertColor) invertViewColor(mainContent) } override fun onViewDetachedFromWindow(view: View) { @@ -233,17 +233,19 @@ object BlurSecurity : BaseHook() { "seekbar_text_speed" ) - val gameManagerMethod = dexKitBridge.findMethod { - searchPackages = listOf("com.miui.gamebooster.windowmanager.newbox") - matcher { - usingStrings = listOf("addView error") - } - }.firstOrNull()?.getMethodInstance(safeClassLoader) + if (isInvertColor) { + val gameManagerMethod = dexKitBridge.findMethod { + searchPackages = listOf("com.miui.gamebooster.windowmanager.newbox") + matcher { + usingStrings = listOf("addView error") + } + }.firstOrNull()?.getMethodInstance(safeClassLoader) - gameManagerMethod!!.createHook { - after { - val view = it.args[0] as View - invertViewColor(view, gameBoxWhiteList, gameBoxKeepList) + gameManagerMethod!!.createHook { + after { + val view = it.args[0] as View + invertViewColor(view, gameBoxWhiteList, gameBoxKeepList) + } } } @@ -296,11 +298,13 @@ object BlurSecurity : BaseHook() { } } if (currentObject is View) { - invertViewColor( - currentObject, - videoBoxWhiteList, - videoBoxKeepList - ) + if (isInvertColor) { + invertViewColor( + currentObject, + videoBoxWhiteList, + videoBoxKeepList + ) + } } } } @@ -379,7 +383,7 @@ object BlurSecurity : BaseHook() { lastChild.setImageDrawable(newDrawable) } } - invertViewColor(view, gameBoxWhiteList, gameBoxKeepList) + if (isInvertColor) invertViewColor(view, gameBoxWhiteList, gameBoxKeepList) } }) } diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 54ffbf1b97..052addf034 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1211,6 +1211,8 @@ 解锁 “智能断充保护” 和 “低电疾充” 功能 解锁极速无线充电模式 全局侧边栏背景自定义 + 图标反色 + 对某些背景下的图标选中颜色进行反色,以达到更好的可视效果\n该功能可能会有反色异常的情况,请酌情开启 全局侧边栏背景模糊程度 全局侧边栏背景叠加层颜色 其他 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index ffcbd441b1..4432688e15 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -1089,6 +1089,8 @@ 解鎖「智能斷充保護」和「低電疾充」功能 解鎖極速無線充電模式 全域側邊欄背景設定 + 圖示反色 + 對某些背景下的圖示選中顏色進行反色,以達到更好的可視效果\n該功能可能會有反色異常的情況,請酌情開啟 全域側邊欄背景模糊程度 全域側邊欄背景疊加層顏色 其他 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 89fd55a883..af61f41ce0 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -1107,6 +1107,8 @@ 解鎖「智能斷充保護」和「低電疾充」功能 解鎖極速無線充電模式 全域側邊欄背景設定 + 圖示反色 + 對某些背景下的圖示選中顏色進行反色,以達到更好的可視效果\n該功能可能會有反色異常的情況,請酌情開啟 全域側邊欄背景模糊程度 全域側邊欄背景疊加層顏色 其他 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5613fee9e0..e424dd7bde 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1181,6 +1181,8 @@ Unlock the “Smart Charge Off Protection” and “Low Battery Quick Charge” functions Unlock Super wireless charge Sidebar blur model + Icon inverted + Invert the selected colors of icons in some backgrounds for better visibility\nThis function may have abnormal color inversions, please enable it as appropriate Sidebar blur value Sidebar color Other diff --git a/app/src/main/res/xml/security_center.xml b/app/src/main/res/xml/security_center.xml index a3b553d0f3..d4b3837fee 100644 --- a/app/src/main/res/xml/security_center.xml +++ b/app/src/main/res/xml/security_center.xml @@ -172,6 +172,13 @@ android:key="prefs_key_se_enable" android:title="@string/security_center_blur_model" /> + +