diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt index 49a8410f37..8c3740c789 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt @@ -6,7 +6,6 @@ import android.os.Environment import androidx.core.content.edit import androidx.core.net.toUri import androidx.preference.PreferenceManager -import com.google.android.material.color.DynamicColors import com.tfcporciuncula.flow.FlowSharedPreferences import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Manga @@ -73,7 +72,7 @@ class PreferencesHelper(val context: Context) { fun appTheme() = flowPrefs.getEnum( "pref_app_theme", - if (DynamicColors.isDynamicColorAvailable()) { Values.AppTheme.MONET } else { Values.AppTheme.DEFAULT } + if (DeviceUtil.isDynamicColorAvailable) { Values.AppTheme.MONET } else { Values.AppTheme.DEFAULT } ) fun themeDarkAmoled() = flowPrefs.getBoolean("pref_theme_dark_amoled_key", false) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAppearanceController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAppearanceController.kt index bb3f6d85b9..0fb1990ee3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAppearanceController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAppearanceController.kt @@ -5,7 +5,6 @@ import android.os.Bundle import android.view.View import androidx.core.app.ActivityCompat import androidx.preference.PreferenceScreen -import com.google.android.material.color.DynamicColors import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.preference.bindTo import eu.kanade.tachiyomi.util.preference.defaultValue @@ -17,6 +16,7 @@ import eu.kanade.tachiyomi.util.preference.onChange import eu.kanade.tachiyomi.util.preference.preferenceCategory import eu.kanade.tachiyomi.util.preference.switchPreference import eu.kanade.tachiyomi.util.preference.titleRes +import eu.kanade.tachiyomi.util.system.DeviceUtil import eu.kanade.tachiyomi.util.system.isTablet import eu.kanade.tachiyomi.widget.preference.ThemesPreference import java.util.Date @@ -67,7 +67,7 @@ class SettingsAppearanceController : SettingsController() { val appThemes = Values.AppTheme.values().filter { val monetFilter = if (it == Values.AppTheme.MONET) { - DynamicColors.isDynamicColorAvailable() + DeviceUtil.isDynamicColorAvailable } else { true } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/DeviceUtil.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/DeviceUtil.kt index 33a132408a..c2b62d8fd6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/DeviceUtil.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/DeviceUtil.kt @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.util.system import android.annotation.SuppressLint import android.os.Build +import com.google.android.material.color.DynamicColors import logcat.LogPriority object DeviceUtil { @@ -30,6 +31,10 @@ object DeviceUtil { Build.MANUFACTURER.equals("samsung", ignoreCase = true) } + val isDynamicColorAvailable by lazy { + DynamicColors.isDynamicColorAvailable() || (isSamsung && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) + } + @SuppressLint("PrivateApi") private fun getSystemProperty(key: String?): String? { return try {