mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-26 19:17:51 +02:00
Add Dynamic theme for Android 12 (#5569)
* Add Dynamic theme for Android 12 * Also theme text colors
This commit is contained in:
@ -23,6 +23,7 @@ object PreferenceValues {
|
||||
|
||||
enum class AppTheme(val titleResId: Int?) {
|
||||
DEFAULT(R.string.theme_default),
|
||||
MONET(R.string.theme_monet),
|
||||
BLUE(R.string.theme_blue),
|
||||
GREEN_APPLE(R.string.theme_greenapple),
|
||||
MIDNIGHT_DUSK(R.string.theme_midnightdusk),
|
||||
|
@ -40,6 +40,9 @@ abstract class BaseThemedActivity : AppCompatActivity() {
|
||||
fun AppCompatActivity.applyThemePreferences(preferences: PreferencesHelper) {
|
||||
val resIds = mutableListOf<Int>()
|
||||
when (preferences.appTheme().get()) {
|
||||
PreferenceValues.AppTheme.MONET -> {
|
||||
resIds += R.style.Theme_Tachiyomi_Monet
|
||||
}
|
||||
PreferenceValues.AppTheme.BLUE -> {
|
||||
resIds += R.style.Theme_Tachiyomi_Blue
|
||||
resIds += R.style.ThemeOverlay_Tachiyomi_ColoredBars
|
||||
|
@ -122,7 +122,14 @@ class SettingsGeneralController : SettingsController() {
|
||||
key = Keys.appTheme
|
||||
titleRes = R.string.pref_app_theme
|
||||
|
||||
val appThemes = Values.AppTheme.values().filter { it.titleResId != null }
|
||||
val appThemes = Values.AppTheme.values().filter {
|
||||
val monetFilter = if (it == Values.AppTheme.MONET) {
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
|
||||
} else {
|
||||
true
|
||||
}
|
||||
it.titleResId != null && monetFilter
|
||||
}
|
||||
entriesRes = appThemes.map { it.titleResId!! }.toTypedArray()
|
||||
entryValues = appThemes.map { it.name }.toTypedArray()
|
||||
defaultValue = appThemes[0].name
|
||||
|
Reference in New Issue
Block a user