feat(theme): Support Dynamic theme for Android 11 and below (#1504)
This commit is contained in:
parent
fe7b10f941
commit
7380e77b5c
4 changed files with 3 additions and 19 deletions
|
|
@ -5,8 +5,6 @@ import com.materialkolor.PaletteStyle
|
|||
import eu.kanade.domain.ui.model.AppTheme
|
||||
import eu.kanade.domain.ui.model.TabletUiMode
|
||||
import eu.kanade.domain.ui.model.ThemeMode
|
||||
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||
import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable
|
||||
import tachiyomi.core.common.preference.PreferenceStore
|
||||
import tachiyomi.core.common.preference.getEnum
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
|
@ -21,11 +19,7 @@ class UiPreferences(
|
|||
|
||||
fun appTheme() = preferenceStore.getEnum(
|
||||
"pref_app_theme",
|
||||
if (DeviceUtil.isDynamicColorAvailable) {
|
||||
AppTheme.MONET
|
||||
} else {
|
||||
AppTheme.DEFAULT
|
||||
},
|
||||
AppTheme.MONET,
|
||||
)
|
||||
|
||||
fun themeDarkAmoled() = preferenceStore.getBoolean("pref_theme_dark_amoled_key", false)
|
||||
|
|
|
|||
|
|
@ -46,8 +46,6 @@ import eu.kanade.domain.ui.UiPreferences
|
|||
import eu.kanade.domain.ui.model.AppTheme
|
||||
import eu.kanade.presentation.manga.components.MangaCover
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||
import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable
|
||||
import tachiyomi.core.common.preference.InMemoryPreferenceStore
|
||||
import tachiyomi.i18n.MR
|
||||
import tachiyomi.presentation.core.components.material.padding
|
||||
|
|
@ -82,7 +80,7 @@ private fun AppThemesList(
|
|||
val context = LocalContext.current
|
||||
val appThemes = remember {
|
||||
AppTheme.entries
|
||||
.filterNot { it.titleRes == null || (it == AppTheme.MONET && !DeviceUtil.isDynamicColorAvailable) }
|
||||
.filterNot { it.titleRes == null }
|
||||
}
|
||||
LazyRow(
|
||||
contentPadding = PaddingValues(horizontal = PrefsHorizontalPadding),
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ internal class MonetCompatColorScheme(seed: Color) : BaseColorScheme() {
|
|||
seedColor = seed,
|
||||
isDark = dark,
|
||||
specVersion = ColorSpec.SpecVersion.SPEC_2025,
|
||||
style = PaletteStyle.Expressive,
|
||||
style = PaletteStyle.TonalSpot,
|
||||
)
|
||||
.toColorScheme(isAmoled = false)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
package eu.kanade.tachiyomi.util.system
|
||||
|
||||
import android.os.Build
|
||||
import com.google.android.material.color.DynamicColors
|
||||
|
||||
val DeviceUtil.isDynamicColorAvailable by lazy {
|
||||
DynamicColors.isDynamicColorAvailable() || (DeviceUtil.isSamsung && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
|
||||
}
|
||||
Loading…
Reference in a new issue