Skip to content

Commit

Permalink
Rename themes and extract names to string resources
Browse files Browse the repository at this point in the history
  • Loading branch information
X1nto committed Mar 30, 2024
1 parent 4381d3c commit 33111bf
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 11 additions & 3 deletions app/src/main/java/com/xinto/mauth/ui/screen/theme/ThemeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/com/xinto/mauth/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@
<string name="theme_theme_system">System</string>
<string name="theme_theme_dark">Dark</string>
<string name="theme_theme_light">Light</string>
<string name="theme_colors_dynamic">Dynamic</string>
<string name="theme_colors_purple">Moth Purple</string>
<string name="theme_colors_blue">Blueberry Blue</string>
<string name="theme_colors_yellow">Pickle Yellow</string>
<string name="theme_colors_green">Toxic Green</string>
<string name="theme_colors_orange">Leather Orange</string>
<string name="theme_colors_turquoise">Ocean Turquoise</string>

<string name="about_title">About</string>
<string name="about_version">Version v%1$s</string>
Expand Down

0 comments on commit 33111bf

Please sign in to comment.