From bf5bb3d8d60a1528d2ce83e70c41b198fd76e076 Mon Sep 17 00:00:00 2001 From: a1studmuffin Date: Fri, 9 Jun 2023 10:49:49 +1000 Subject: [PATCH 1/2] Fixed up ThemeMode enum to use strings in UI (adds space to "System Black" theme mode) --- app/src/main/java/com/jerboa/Utils.kt | 12 ++++++------ .../settings/lookandfeel/LookAndFeelActivity.kt | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/jerboa/Utils.kt b/app/src/main/java/com/jerboa/Utils.kt index 43a2af932..ed0532429 100644 --- a/app/src/main/java/com/jerboa/Utils.kt +++ b/app/src/main/java/com/jerboa/Utils.kt @@ -723,12 +723,12 @@ fun Context.findActivity(): Activity? = when (this) { else -> null } -enum class ThemeMode { - System, - SystemBlack, - Light, - Dark, - Black, +enum class ThemeMode(val mode: String) { + System("System"), + SystemBlack("System Black"), + Light("Light"), + Dark("Dark"), + Black("Black"), } enum class ThemeColor { diff --git a/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt b/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt index e3b2e79a7..7edf178ec 100644 --- a/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt @@ -95,7 +95,7 @@ fun LookAndFeelActivity( ) SettingsList( state = themeState, - items = ThemeMode.values().map { it.name }, + items = ThemeMode.values().map { it.mode }, icon = { Icon( imageVector = Icons.Outlined.Palette, From 2428570ee275b6783b606cd985ff36cbd385e2b4 Mon Sep 17 00:00:00 2001 From: a1studmuffin Date: Sat, 10 Jun 2023 09:06:34 +1000 Subject: [PATCH 2/2] Updated strings.xml, moved PostViewMode enum to strings as well --- app/src/main/java/com/jerboa/Utils.kt | 20 +++++++++---------- .../jerboa/ui/components/common/Dialogs.kt | 2 +- .../lookandfeel/LookAndFeelActivity.kt | 4 ++-- app/src/main/res/values-de/strings.xml | 8 ++++++++ app/src/main/res/values/strings.xml | 8 ++++++++ 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/jerboa/Utils.kt b/app/src/main/java/com/jerboa/Utils.kt index 745ab4f53..7593da0d1 100644 --- a/app/src/main/java/com/jerboa/Utils.kt +++ b/app/src/main/java/com/jerboa/Utils.kt @@ -724,12 +724,12 @@ fun Context.findActivity(): Activity? = when (this) { else -> null } -enum class ThemeMode(val mode: String) { - System("System"), - SystemBlack("System Black"), - Light("Light"), - Dark("Dark"), - Black("Black"), +enum class ThemeMode(val mode: Int) { + System(R.string.look_and_feel_theme_system), + SystemBlack(R.string.look_and_feel_theme_system_black), + Light(R.string.look_and_feel_theme_light), + Dark(R.string.look_and_feel_theme_dark), + Black(R.string.look_and_feel_theme_black), } enum class ThemeColor { @@ -739,22 +739,22 @@ enum class ThemeColor { Blue, } -enum class PostViewMode(val mode: String) { +enum class PostViewMode(val mode: Int) { /** * The full size post view card. For image posts, this expands them to their full height. For * link posts, the thumbnail is shown to the right of the title. */ - Card("Card"), + Card(R.string.look_and_feel_post_view_card), /** * The same as regular card, except image posts only show a thumbnail image. */ - SmallCard("Small Card"), + SmallCard(R.string.look_and_feel_post_view_small_card), /** * A list view that has no action bar. */ - List("List"), + List(R.string.look_and_feel_post_view_list), } @ExperimentalPagerApi diff --git a/app/src/main/java/com/jerboa/ui/components/common/Dialogs.kt b/app/src/main/java/com/jerboa/ui/components/common/Dialogs.kt index 579ad1e77..b7a9acc8f 100644 --- a/app/src/main/java/com/jerboa/ui/components/common/Dialogs.kt +++ b/app/src/main/java/com/jerboa/ui/components/common/Dialogs.kt @@ -243,7 +243,7 @@ fun PostViewModeDialog( Column { PostViewMode.values().map { IconAndTextDrawerItem( - text = it.mode, + text = stringResource(it.mode), onClick = { onClickPostViewMode(it) }, highlight = (selectedPostViewMode == it), ) diff --git a/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt b/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt index 21709fb69..dff301a4f 100644 --- a/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt @@ -102,7 +102,7 @@ fun LookAndFeelActivity( ) SettingsList( state = themeState, - items = ThemeMode.values().map { it.mode }, + items = ThemeMode.values().map { stringResource(it.mode) }, icon = { Icon( imageVector = Icons.Outlined.Palette, @@ -136,7 +136,7 @@ fun LookAndFeelActivity( ) SettingsList( state = postViewModeState, - items = PostViewMode.values().map { it.mode }, + items = PostViewMode.values().map { stringResource(it.mode) }, icon = { Icon( imageVector = Icons.Outlined.ViewList, diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 54f1a3b05..cb30d4e2b 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -171,8 +171,16 @@ Look and feel Schriftgröße: %1$s Theme + System + System Black + Light + Dark + Black Theme color Beitragssansicht + Card + Small Card + List Zeige Navigationsleiste Einstellungen Look and feel diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index af64d8f19..01d0b57c3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -171,8 +171,16 @@ Look and feel Font size: %1$s Theme + System + System Black + Light + Dark + Black Theme color Post View + Card + Small Card + List Show navigation bar Settings Look and feel