透明主题未要求设置背景问题 #158

This commit is contained in:
HapeLee
2025-10-28 00:43:07 +08:00
parent 85e5f9bc22
commit e1d581375a
3 changed files with 10 additions and 10 deletions
@@ -81,7 +81,7 @@ class ThemeCardPreference(context: Context, attrs: AttributeSet) : Preference(co
holder.card.setOnClickListener {
if (value != currentValue) {
if (value == "12") {
if (value == "13") {
val hasLightBg = !appCtx.getPrefString(PreferKey.bgImage).isNullOrEmpty()
val hasDarkBg = !appCtx.getPrefString(PreferKey.bgImageN).isNullOrEmpty()
if (!hasLightBg || !hasDarkBg) {
@@ -94,7 +94,7 @@ class ThemeCardPreference(context: Context, attrs: AttributeSet) : Preference(co
persistString(value)
callChangeListener(value)
notifyDataSetChanged()
val isDynamicSwitch = (oldValue == "11" || value == "11")
val isDynamicSwitch = (oldValue == "12" || value == "12")
Handler(Looper.getMainLooper()).postDelayed({
if (isDynamicSwitch) {
context.alert(context.getString(R.string.restart_required_message)) {
@@ -121,9 +121,9 @@ class ThemeConfigFragment : PreferenceFragmentCompat(),
val customMode = findPreference<NameListPreference>("customMode")
val currentTheme = getPrefString("app_theme")
colorPrimary?.isVisible = currentTheme == "11"
colorImage?.isVisible = currentTheme == "11"
customMode?.isVisible = currentTheme == "11"
colorPrimary?.isVisible = currentTheme == "12"
colorImage?.isVisible = currentTheme == "12"
customMode?.isVisible = currentTheme == "12"
themePref?.let {
it.setOnPreferenceChangeListener { _, _ ->
@@ -132,9 +132,9 @@ class ThemeConfigFragment : PreferenceFragmentCompat(),
}
themePref?.setOnPreferenceChangeListener { _, newValue ->
colorPrimary?.isVisible = newValue == "11"
colorImage?.isVisible = currentTheme == "11"
customMode?.isVisible = newValue == "11"
colorPrimary?.isVisible = newValue == "12"
colorImage?.isVisible = currentTheme == "12"
customMode?.isVisible = newValue == "12"
true
}