refactor: rearrange settings (#484)
This commit is contained in:
parent
810acd76b4
commit
30152548d9
@ -244,23 +244,6 @@ class SettingsScreen : Screen {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// system bar theme
|
|
||||||
if (uiState.edgeToEdge) {
|
|
||||||
val barThemeName = if (uiState.opaqueSystemBars) {
|
|
||||||
UiBarTheme.Opaque.toReadableName()
|
|
||||||
} else {
|
|
||||||
UiBarTheme.Transparent.toReadableName()
|
|
||||||
}
|
|
||||||
SettingsRow(
|
|
||||||
title = stringResource(MR.strings.settings_bar_theme),
|
|
||||||
value = barThemeName,
|
|
||||||
onTap = rememberCallback {
|
|
||||||
val sheet = BarThemeBottomSheet()
|
|
||||||
navigationCoordinator.showBottomSheet(sheet)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// custom scheme seed color
|
// custom scheme seed color
|
||||||
SettingsColorRow(
|
SettingsColorRow(
|
||||||
title = stringResource(MR.strings.settings_custom_seed_color),
|
title = stringResource(MR.strings.settings_custom_seed_color),
|
||||||
@ -340,6 +323,7 @@ class SettingsScreen : Screen {
|
|||||||
navigationCoordinator.showBottomSheet(sheet)
|
navigationCoordinator.showBottomSheet(sheet)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
SettingsRow(
|
SettingsRow(
|
||||||
title = stringResource(MR.strings.settings_content_font_family),
|
title = stringResource(MR.strings.settings_content_font_family),
|
||||||
value = uiState.contentFontFamily.toReadableName(),
|
value = uiState.contentFontFamily.toReadableName(),
|
||||||
@ -373,6 +357,61 @@ class SettingsScreen : Screen {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// navigation bar titles
|
||||||
|
SettingsSwitchRow(
|
||||||
|
title = stringResource(MR.strings.settings_navigation_bar_titles_visible),
|
||||||
|
value = uiState.navBarTitlesVisible,
|
||||||
|
onValueChanged = rememberCallbackArgs(model) { value ->
|
||||||
|
model.reduce(
|
||||||
|
SettingsMviModel.Intent.ChangeNavBarTitlesVisible(value)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
// edge to edge
|
||||||
|
SettingsSwitchRow(
|
||||||
|
title = stringResource(MR.strings.settings_edge_to_edge),
|
||||||
|
value = uiState.edgeToEdge,
|
||||||
|
onValueChanged = rememberCallbackArgs(model) { value ->
|
||||||
|
model.reduce(
|
||||||
|
SettingsMviModel.Intent.ChangeEdgeToEdge(value)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
// system bar theme
|
||||||
|
if (uiState.edgeToEdge) {
|
||||||
|
val barThemeName = if (uiState.opaqueSystemBars) {
|
||||||
|
UiBarTheme.Opaque.toReadableName()
|
||||||
|
} else {
|
||||||
|
UiBarTheme.Transparent.toReadableName()
|
||||||
|
}
|
||||||
|
SettingsRow(
|
||||||
|
title = stringResource(MR.strings.settings_bar_theme),
|
||||||
|
value = barThemeName,
|
||||||
|
onTap = rememberCallback {
|
||||||
|
val sheet = BarThemeBottomSheet()
|
||||||
|
navigationCoordinator.showBottomSheet(sheet)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// bottom navigation hiding
|
||||||
|
SettingsSwitchRow(
|
||||||
|
title = stringResource(MR.strings.settings_hide_navigation_bar),
|
||||||
|
value = uiState.hideNavigationBarWhileScrolling,
|
||||||
|
onValueChanged = rememberCallbackArgs(model) { value ->
|
||||||
|
model.reduce(
|
||||||
|
SettingsMviModel.Intent.ChangeHideNavigationBarWhileScrolling(value)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
SettingsHeader(
|
||||||
|
icon = Icons.Default.Dashboard,
|
||||||
|
title = stringResource(MR.strings.settings_section_feed),
|
||||||
|
)
|
||||||
|
|
||||||
// post layout
|
// post layout
|
||||||
SettingsRow(
|
SettingsRow(
|
||||||
title = stringResource(MR.strings.settings_post_layout),
|
title = stringResource(MR.strings.settings_post_layout),
|
||||||
@ -399,16 +438,6 @@ class SettingsScreen : Screen {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// vote format
|
|
||||||
SettingsRow(
|
|
||||||
title = stringResource(MR.strings.settings_vote_format),
|
|
||||||
value = uiState.voteFormat.toReadableName(),
|
|
||||||
onTap = {
|
|
||||||
val sheet = VoteFormatBottomSheet()
|
|
||||||
navigationCoordinator.showBottomSheet(sheet)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
// full height images
|
// full height images
|
||||||
SettingsSwitchRow(
|
SettingsSwitchRow(
|
||||||
title = stringResource(MR.strings.settings_full_height_images),
|
title = stringResource(MR.strings.settings_full_height_images),
|
||||||
@ -420,20 +449,25 @@ class SettingsScreen : Screen {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
// navigation bar titles
|
// vote format
|
||||||
SettingsSwitchRow(
|
SettingsRow(
|
||||||
title = stringResource(MR.strings.settings_navigation_bar_titles_visible),
|
title = stringResource(MR.strings.settings_vote_format),
|
||||||
value = uiState.navBarTitlesVisible,
|
value = uiState.voteFormat.toReadableName(),
|
||||||
onValueChanged = rememberCallbackArgs(model) { value ->
|
onTap = {
|
||||||
model.reduce(
|
val sheet = VoteFormatBottomSheet()
|
||||||
SettingsMviModel.Intent.ChangeNavBarTitlesVisible(value)
|
navigationCoordinator.showBottomSheet(sheet)
|
||||||
)
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
SettingsHeader(
|
// auto-expand comments
|
||||||
icon = Icons.Default.Dashboard,
|
SettingsSwitchRow(
|
||||||
title = stringResource(MR.strings.settings_section_feed),
|
title = stringResource(MR.strings.settings_auto_expand_comments),
|
||||||
|
value = uiState.autoExpandComments,
|
||||||
|
onValueChanged = rememberCallbackArgs(model) { value ->
|
||||||
|
model.reduce(
|
||||||
|
SettingsMviModel.Intent.ChangeAutoExpandComments(value)
|
||||||
|
)
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
// default listing type
|
// default listing type
|
||||||
@ -499,17 +533,6 @@ class SettingsScreen : Screen {
|
|||||||
title = stringResource(MR.strings.settings_section_behaviour),
|
title = stringResource(MR.strings.settings_section_behaviour),
|
||||||
)
|
)
|
||||||
|
|
||||||
// edge to edge
|
|
||||||
SettingsSwitchRow(
|
|
||||||
title = stringResource(MR.strings.settings_edge_to_edge),
|
|
||||||
value = uiState.edgeToEdge,
|
|
||||||
onValueChanged = rememberCallbackArgs(model) { value ->
|
|
||||||
model.reduce(
|
|
||||||
SettingsMviModel.Intent.ChangeEdgeToEdge(value)
|
|
||||||
)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
// infinite scrolling
|
// infinite scrolling
|
||||||
SettingsSwitchRow(
|
SettingsSwitchRow(
|
||||||
title = stringResource(MR.strings.settings_infinite_scroll_disabled),
|
title = stringResource(MR.strings.settings_infinite_scroll_disabled),
|
||||||
@ -598,17 +621,6 @@ class SettingsScreen : Screen {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// bottom navigation hiding
|
|
||||||
SettingsSwitchRow(
|
|
||||||
title = stringResource(MR.strings.settings_hide_navigation_bar),
|
|
||||||
value = uiState.hideNavigationBarWhileScrolling,
|
|
||||||
onValueChanged = rememberCallbackArgs(model) { value ->
|
|
||||||
model.reduce(
|
|
||||||
SettingsMviModel.Intent.ChangeHideNavigationBarWhileScrolling(value)
|
|
||||||
)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
// URL open
|
// URL open
|
||||||
SettingsSwitchRow(
|
SettingsSwitchRow(
|
||||||
title = stringResource(MR.strings.settings_open_url_external),
|
title = stringResource(MR.strings.settings_open_url_external),
|
||||||
@ -620,17 +632,6 @@ class SettingsScreen : Screen {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
// auto-expand comments
|
|
||||||
SettingsSwitchRow(
|
|
||||||
title = stringResource(MR.strings.settings_auto_expand_comments),
|
|
||||||
value = uiState.autoExpandComments,
|
|
||||||
onValueChanged = rememberCallbackArgs(model) { value ->
|
|
||||||
model.reduce(
|
|
||||||
SettingsMviModel.Intent.ChangeAutoExpandComments(value)
|
|
||||||
)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
// image loading
|
// image loading
|
||||||
SettingsSwitchRow(
|
SettingsSwitchRow(
|
||||||
title = stringResource(MR.strings.settings_auto_load_images),
|
title = stringResource(MR.strings.settings_auto_load_images),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user