From 3ab83f1270075a871e68242d3d08876dfad619b1 Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Sat, 27 Dec 2025 00:50:03 +0600 Subject: [PATCH] Switch to MaterialExpressiveTheme Co-authored-by: Cuong-Tran <16017808+cuong-tran@users.noreply.github.com> (cherry picked from commit 3e6afee13b9fd5716f7f2d547b3edcd3e17915db) --- app/build.gradle.kts | 1 + app/src/main/java/eu/kanade/domain/ui/UiPreferences.kt | 4 ++-- .../more/settings/screen/SettingsAppearanceScreen.kt | 8 ++++---- .../java/eu/kanade/presentation/theme/TachiyomiTheme.kt | 7 ++++--- .../presentation/theme/colorscheme/CustomColorScheme.kt | 2 ++ .../presentation/theme/colorscheme/MonetColorScheme.kt | 9 ++++++++- .../java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt | 2 ++ 7 files changed, 23 insertions(+), 10 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 67a709169..943ae0560 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -168,6 +168,7 @@ kotlin { "-opt-in=androidx.compose.foundation.ExperimentalFoundationApi", "-opt-in=androidx.compose.foundation.layout.ExperimentalLayoutApi", "-opt-in=androidx.compose.material3.ExperimentalMaterial3Api", + "-opt-in=androidx.compose.material3.ExperimentalMaterial3ExpressiveApi", "-opt-in=androidx.compose.ui.ExperimentalComposeUiApi", "-opt-in=coil3.annotation.ExperimentalCoilApi", "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", diff --git a/app/src/main/java/eu/kanade/domain/ui/UiPreferences.kt b/app/src/main/java/eu/kanade/domain/ui/UiPreferences.kt index 1ef4a874c..75bdf132c 100644 --- a/app/src/main/java/eu/kanade/domain/ui/UiPreferences.kt +++ b/app/src/main/java/eu/kanade/domain/ui/UiPreferences.kt @@ -33,11 +33,11 @@ class UiPreferences( // KMK --> fun colorTheme() = preferenceStore.getInt("pref_color_theme", 0xFFDF0090.toInt()) - fun customThemeStyle() = preferenceStore.getEnum("pref_custom_theme_style_key", PaletteStyle.Fidelity) + fun customThemeStyle() = preferenceStore.getEnum("pref_custom_theme_style_key", PaletteStyle.Expressive) fun themeCoverBased() = preferenceStore.getBoolean("pref_theme_cover_based_key", true) - fun themeCoverBasedStyle() = preferenceStore.getEnum("pref_theme_cover_based_style_key", PaletteStyle.Vibrant) + fun themeCoverBasedStyle() = preferenceStore.getEnum("pref_theme_cover_based_style_key", PaletteStyle.Expressive) fun preloadLibraryColor() = preferenceStore.getBoolean("pref_preload_library_color_key", true) // KMK <-- diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAppearanceScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAppearanceScreen.kt index 8ebe807a5..9491d8de2 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAppearanceScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAppearanceScreen.kt @@ -112,14 +112,14 @@ object SettingsAppearanceScreen : SearchableSettings { entries = PaletteStyle.entries .associateWith { when (it) { + PaletteStyle.Expressive -> + stringResource(KMR.strings.pref_theme_cover_based_style_expressive) PaletteStyle.TonalSpot -> stringResource(KMR.strings.pref_theme_cover_based_style_tonalspot) PaletteStyle.Neutral -> stringResource(KMR.strings.pref_theme_cover_based_style_neutral) PaletteStyle.Vibrant -> stringResource(KMR.strings.pref_theme_cover_based_style_vibrant) - PaletteStyle.Expressive -> - stringResource(KMR.strings.pref_theme_cover_based_style_expressive) PaletteStyle.Rainbow -> stringResource(KMR.strings.pref_theme_cover_based_style_rainbow) PaletteStyle.FruitSalad -> @@ -175,14 +175,14 @@ object SettingsAppearanceScreen : SearchableSettings { entries = PaletteStyle.entries .associateWith { when (it) { + PaletteStyle.Expressive -> + stringResource(KMR.strings.pref_theme_cover_based_style_expressive) PaletteStyle.TonalSpot -> stringResource(KMR.strings.pref_theme_cover_based_style_tonalspot) PaletteStyle.Neutral -> stringResource(KMR.strings.pref_theme_cover_based_style_neutral) PaletteStyle.Vibrant -> stringResource(KMR.strings.pref_theme_cover_based_style_vibrant) - PaletteStyle.Expressive -> - stringResource(KMR.strings.pref_theme_cover_based_style_expressive) PaletteStyle.Rainbow -> stringResource(KMR.strings.pref_theme_cover_based_style_rainbow) PaletteStyle.FruitSalad -> diff --git a/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt b/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt index b72f54557..a2dcec1ab 100644 --- a/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt +++ b/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt @@ -3,13 +3,14 @@ package eu.kanade.presentation.theme import android.content.Context import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material3.ColorScheme +import androidx.compose.material3.MaterialExpressiveTheme import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Typography import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext -import com.materialkolor.DynamicMaterialTheme +import com.materialkolor.DynamicMaterialExpressiveTheme import eu.kanade.domain.ui.UiPreferences import eu.kanade.domain.ui.model.AppTheme import eu.kanade.presentation.theme.colorscheme.BaseColorScheme @@ -66,7 +67,7 @@ fun TachiyomiTheme( } else { val uiPreferences = Injekt.get() val isAmoled = amoled ?: uiPreferences.themeDarkAmoled().get() - DynamicMaterialTheme( + DynamicMaterialExpressiveTheme( seedColor = seedColor, isAmoled = isAmoled, style = uiPreferences.themeCoverBasedStyle().get(), @@ -93,7 +94,7 @@ private fun BaseTachiyomiTheme( ) { val context = LocalContext.current val isDark = isSystemInDarkTheme() - MaterialTheme( + MaterialExpressiveTheme( colorScheme = remember(appTheme, isDark, isAmoled) { getThemeColorScheme( context = context, diff --git a/app/src/main/java/eu/kanade/presentation/theme/colorscheme/CustomColorScheme.kt b/app/src/main/java/eu/kanade/presentation/theme/colorscheme/CustomColorScheme.kt index f79340c00..2d1c93e82 100644 --- a/app/src/main/java/eu/kanade/presentation/theme/colorscheme/CustomColorScheme.kt +++ b/app/src/main/java/eu/kanade/presentation/theme/colorscheme/CustomColorScheme.kt @@ -14,6 +14,7 @@ import com.google.android.material.textfield.TextInputEditText import com.google.android.material.textfield.TextInputLayout import com.materialkolor.PaletteStyle import com.materialkolor.dynamicColorScheme +import com.materialkolor.dynamiccolor.ColorSpec internal class CustomColorScheme( seed: Color, @@ -29,6 +30,7 @@ internal class CustomColorScheme( isDark = dark, isAmoled = false, style = style, + specVersion = ColorSpec.SpecVersion.SPEC_2025, ) } } diff --git a/app/src/main/java/eu/kanade/presentation/theme/colorscheme/MonetColorScheme.kt b/app/src/main/java/eu/kanade/presentation/theme/colorscheme/MonetColorScheme.kt index fb670babe..039d4bd16 100644 --- a/app/src/main/java/eu/kanade/presentation/theme/colorscheme/MonetColorScheme.kt +++ b/app/src/main/java/eu/kanade/presentation/theme/colorscheme/MonetColorScheme.kt @@ -8,6 +8,8 @@ import androidx.compose.material3.ColorScheme import androidx.compose.material3.dynamicDarkColorScheme import androidx.compose.material3.dynamicLightColorScheme import androidx.compose.ui.graphics.Color +import com.materialkolor.PaletteStyle +import com.materialkolor.dynamiccolor.ColorSpec import com.materialkolor.ktx.DynamicScheme import com.materialkolor.toColorScheme @@ -48,7 +50,12 @@ internal class MonetCompatColorScheme(seed: Color) : BaseColorScheme() { companion object { fun generateColorSchemeFromSeed(seed: Color, dark: Boolean): ColorScheme { - return DynamicScheme(seedColor = seed, isDark = dark) + return DynamicScheme( + seedColor = seed, + isDark = dark, + specVersion = ColorSpec.SpecVersion.SPEC_2025, + style = PaletteStyle.Expressive, + ) .toColorScheme(isAmoled = false) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index b934b8ea4..a600e5130 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -59,6 +59,7 @@ import com.google.android.material.elevation.SurfaceColors import com.google.android.material.transition.platform.MaterialContainerTransform import com.hippo.unifile.UniFile import com.materialkolor.dynamicColorScheme +import com.materialkolor.dynamiccolor.ColorSpec import dev.chrisbanes.insetter.applyInsetter import eu.kanade.core.util.ifSourcesLoaded import eu.kanade.domain.base.BasePreferences @@ -767,6 +768,7 @@ class ReaderActivity : BaseActivity() { isDark = isNightMode(), isAmoled = themeDarkAmoled, style = themeCoverBasedStyle, + specVersion = ColorSpec.SpecVersion.SPEC_2025, ) } // KMK <--