From 33111bf2f660b422b17b6d56c3461cdb080b8a07 Mon Sep 17 00:00:00 2001 From: Xinto Date: Sat, 30 Mar 2024 12:37:15 +0400 Subject: [PATCH] Rename themes and extract names to string resources --- .../mauth/core/settings/model/ColorSetting.kt | 8 ++++---- .../com/xinto/mauth/ui/screen/theme/ThemeScreen.kt | 14 +++++++++++--- .../main/java/com/xinto/mauth/ui/theme/Theme.kt | 8 ++++---- app/src/main/res/values/strings.xml | 7 +++++++ 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/xinto/mauth/core/settings/model/ColorSetting.kt b/app/src/main/java/com/xinto/mauth/core/settings/model/ColorSetting.kt index 41b7afc..47aaa12 100644 --- a/app/src/main/java/com/xinto/mauth/core/settings/model/ColorSetting.kt +++ b/app/src/main/java/com/xinto/mauth/core/settings/model/ColorSetting.kt @@ -6,10 +6,10 @@ enum class ColorSetting { Dynamic, MothPurple, BlueberryBlue, - LemonYellow, - LimeGreen, - OrangeOrange, - SkyCyan; + PickleYellow, + ToxicGreen, + LeatherOrange, + OceanTurquoise; companion object { val DEFAULT = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) Dynamic else MothPurple diff --git a/app/src/main/java/com/xinto/mauth/ui/screen/theme/ThemeScreen.kt b/app/src/main/java/com/xinto/mauth/ui/screen/theme/ThemeScreen.kt index e12d598..4eafab9 100644 --- a/app/src/main/java/com/xinto/mauth/ui/screen/theme/ThemeScreen.kt +++ b/app/src/main/java/com/xinto/mauth/ui/screen/theme/ThemeScreen.kt @@ -133,10 +133,18 @@ fun ThemeScreen( onColorChange(colorSetting) }, name = { - val name = remember(colorSetting) { - colorSetting.name.split(Regex("(?=[A-Z])")).joinToString(" ") + val nameRes = remember(colorSetting) { + when (colorSetting) { + ColorSetting.Dynamic -> R.string.theme_colors_dynamic + ColorSetting.MothPurple -> R.string.theme_colors_purple + ColorSetting.BlueberryBlue -> R.string.theme_colors_blue + ColorSetting.PickleYellow -> R.string.theme_colors_yellow + ColorSetting.ToxicGreen -> R.string.theme_colors_green + ColorSetting.LeatherOrange -> R.string.theme_colors_orange + ColorSetting.OceanTurquoise -> R.string.theme_colors_turquoise + } } - Text(name) + Text(stringResource(nameRes)) }, selected = color == colorSetting ) diff --git a/app/src/main/java/com/xinto/mauth/ui/theme/Theme.kt b/app/src/main/java/com/xinto/mauth/ui/theme/Theme.kt index 3f7567e..9d50c84 100644 --- a/app/src/main/java/com/xinto/mauth/ui/theme/Theme.kt +++ b/app/src/main/java/com/xinto/mauth/ui/theme/Theme.kt @@ -47,19 +47,19 @@ fun MauthTheme( true -> DarkBlueberryBlue false -> LightBlueberryBlue } - color == ColorSetting.LemonYellow -> when (isDark) { + color == ColorSetting.PickleYellow -> when (isDark) { true -> DarkLemonYellow false -> LightLemonYellow } - color == ColorSetting.LimeGreen -> when (isDark) { + color == ColorSetting.ToxicGreen -> when (isDark) { true -> DarkLimeGreen false -> LightLimeGreen } - color == ColorSetting.OrangeOrange -> when (isDark) { + color == ColorSetting.LeatherOrange -> when (isDark) { true -> DarkOrangeOrange false -> LightOrangeOrange } - color == ColorSetting.SkyCyan -> when (isDark) { + color == ColorSetting.OceanTurquoise -> when (isDark) { true -> DarkSkyCyan false -> LightSkyCyan } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 77c92ca..c6ceacf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -77,6 +77,13 @@ System Dark Light + Dynamic + Moth Purple + Blueberry Blue + Pickle Yellow + Toxic Green + Leather Orange + Ocean Turquoise About Version v%1$s