diff --git a/app/src/main/java/io/legado/app/base/BaseActivity.kt b/app/src/main/java/io/legado/app/base/BaseActivity.kt index 433ce1ba5..306e61943 100644 --- a/app/src/main/java/io/legado/app/base/BaseActivity.kt +++ b/app/src/main/java/io/legado/app/base/BaseActivity.kt @@ -20,6 +20,7 @@ import io.legado.app.R import io.legado.app.constant.AppConst import io.legado.app.constant.PreferKey import io.legado.app.constant.PreferKey.bgImageBlurring +import io.legado.app.constant.PreferKey.bgImageNBlurring import io.legado.app.constant.Theme import io.legado.app.help.AppConfig import io.legado.app.help.ThemeConfig @@ -189,9 +190,16 @@ abstract class BaseActivity( } private fun getBackgroundImage(bitmap: Bitmap): Bitmap { - PreferenceManager.getDefaultSharedPreferences(this).getInt(bgImageBlurring, 0).apply { - if (this != 0) { - return Toolkit.blur(bitmap, this) + when (Theme.getTheme()) { + Theme.Light -> PreferenceManager.getDefaultSharedPreferences(this).getInt(bgImageBlurring, 0).apply { + if (this != 0) { + return Toolkit.blur(bitmap, this) + } + } + Theme.Dark -> PreferenceManager.getDefaultSharedPreferences(this).getInt(bgImageNBlurring, 0).apply { + if (this != 0) { + return Toolkit.blur(bitmap, this) + } } } return bitmap diff --git a/app/src/main/java/io/legado/app/constant/PreferKey.kt b/app/src/main/java/io/legado/app/constant/PreferKey.kt index 59c10f8e8..d2224a584 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -98,5 +98,6 @@ object PreferKey { const val cNBackground = "colorBackgroundNight" const val cNBBackground = "colorBottomBackgroundNight" const val bgImageN = "backgroundImageNight" + const val bgImageNBlurring = "backgroundImageNightBlurring" } diff --git a/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt index 2f8976d08..8f6163216 100644 --- a/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt @@ -183,9 +183,8 @@ class ThemeConfigFragment : BasePreferenceFragment(), } } } - PreferKey.bgImageBlurring -> { - ImageBlurringDialogFragment(PreferKey.bgImageBlurring) { upTheme(false) }.show(parentFragmentManager) - } + PreferKey.bgImageBlurring -> ImageBlurringDialogFragment(PreferKey.bgImageBlurring) { upTheme(false) }.show(parentFragmentManager) + PreferKey.bgImageNBlurring -> ImageBlurringDialogFragment(PreferKey.bgImageNBlurring) { upTheme(true) }.show(parentFragmentManager) PreferKey.defaultCover -> if (getPrefString(PreferKey.defaultCover).isNullOrEmpty()) { selectImage.launch(requestCodeCover) } else { diff --git a/app/src/main/res/xml/pref_config_theme.xml b/app/src/main/res/xml/pref_config_theme.xml index 50ffb4172..564cb9811 100644 --- a/app/src/main/res/xml/pref_config_theme.xml +++ b/app/src/main/res/xml/pref_config_theme.xml @@ -153,6 +153,10 @@ android:key="backgroundImageNight" android:title="@string/background_image" /> + +