Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed up ThemeMode enum to use strings in UI #469

Merged
merged 3 commits into from
Jun 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions app/src/main/java/com/jerboa/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -724,12 +724,12 @@ fun Context.findActivity(): Activity? = when (this) {
else -> null
}

enum class ThemeMode {
System,
SystemBlack,
Light,
Dark,
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 {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ fun PostViewModeDialog(
Column {
PostViewMode.values().map {
IconAndTextDrawerItem(
text = it.mode,
text = stringResource(it.mode),
onClick = { onClickPostViewMode(it) },
highlight = (selectedPostViewMode == it),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fun LookAndFeelActivity(
)
SettingsList(
state = themeState,
items = ThemeMode.values().map { it.name },
items = ThemeMode.values().map { stringResource(it.mode) },
icon = {
Icon(
imageVector = Icons.Outlined.Palette,
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,16 @@
<string name="look_and_feel_look_and_feel">Look and feel</string>
<string name="look_and_feel_font_size">Schriftgröße: %1$s</string>
<string name="look_and_feel_theme">Theme</string>
<string name="look_and_feel_theme_system">System</string>
<string name="look_and_feel_theme_system_black">System Black</string>
<string name="look_and_feel_theme_light">Light</string>
<string name="look_and_feel_theme_dark">Dark</string>
<string name="look_and_feel_theme_black">Black</string>
<string name="look_and_feel_theme_color">Theme color</string>
<string name="look_and_feel_post_view">Beitragssansicht</string>
<string name="look_and_feel_post_view_card">Card</string>
<string name="look_and_feel_post_view_small_card">Small Card</string>
<string name="look_and_feel_post_view_list">List</string>
<string name="look_and_feel_show_navigation_bar">Zeige Navigationsleiste</string>
<string name="settings_activity_settings">Einstellungen</string>
<string name="settings_activity_look_and_feel">Look and feel</string>
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,16 @@
<string name="look_and_feel_look_and_feel">Look and feel</string>
<string name="look_and_feel_font_size">Font size: %1$s</string>
<string name="look_and_feel_theme">Theme</string>
<string name="look_and_feel_theme_system">System</string>
<string name="look_and_feel_theme_system_black">System Black</string>
<string name="look_and_feel_theme_light">Light</string>
<string name="look_and_feel_theme_dark">Dark</string>
<string name="look_and_feel_theme_black">Black</string>
<string name="look_and_feel_theme_color">Theme color</string>
<string name="look_and_feel_post_view">Post View</string>
<string name="look_and_feel_post_view_card">Card</string>
<string name="look_and_feel_post_view_small_card">Small Card</string>
<string name="look_and_feel_post_view_list">List</string>
<string name="look_and_feel_show_navigation_bar">Show navigation bar</string>
<string name="settings_activity_settings">Settings</string>
<string name="settings_activity_look_and_feel">Look and feel</string>
Expand Down