feat(settings): optional "Calendar" launcher name (#44) #86
@@ -488,6 +488,7 @@ private fun AppearanceScreen(
|
|||||||
var showPastEvents by remember { mutableStateOf(false) }
|
var showPastEvents by remember { mutableStateOf(false) }
|
||||||
var showBrandFont by remember { mutableStateOf(false) }
|
var showBrandFont by remember { mutableStateOf(false) }
|
||||||
var showPlainFont by remember { mutableStateOf(false) }
|
var showPlainFont by remember { mutableStateOf(false) }
|
||||||
|
var showAppName by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
val fonts by viewModel.fontState.collectAsStateWithLifecycle()
|
val fonts by viewModel.fontState.collectAsStateWithLifecycle()
|
||||||
val launcherName by viewModel.launcherName.collectAsStateWithLifecycle()
|
val launcherName by viewModel.launcherName.collectAsStateWithLifecycle()
|
||||||
@@ -684,35 +685,31 @@ private fun AppearanceScreen(
|
|||||||
|
|
||||||
Spacer(Modifier.height(16.dp))
|
Spacer(Modifier.height(16.dp))
|
||||||
|
|
||||||
// App name — flips the launcher label between "Calendula" and "Calendar"
|
// App name — chooses the launcher label between "Calendula" and "Calendar"
|
||||||
// (issue #44). Own group: it's a launcher/system concern, not calendar
|
// (issue #44). Own group: it's a launcher/system concern, not calendar
|
||||||
// formatting.
|
// formatting. A sub-page chooser (not a switch), matching the app's other
|
||||||
|
// "choose one" settings and leaving room for more names later.
|
||||||
GroupedRow(
|
GroupedRow(
|
||||||
title = stringResource(R.string.settings_app_name),
|
title = stringResource(R.string.settings_app_name),
|
||||||
summary = stringResource(R.string.settings_app_name_summary),
|
summary = launcherNameLabel(launcherName),
|
||||||
position = Position.Alone,
|
position = Position.Alone,
|
||||||
trailing = {
|
onClick = { showAppName = true },
|
||||||
Switch(
|
|
||||||
checked = launcherName == LauncherName.CALENDAR,
|
|
||||||
onCheckedChange = {
|
|
||||||
viewModel.setLauncherName(
|
|
||||||
if (it) LauncherName.CALENDAR else LauncherName.CALENDULA,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
},
|
|
||||||
onClick = {
|
|
||||||
viewModel.setLauncherName(
|
|
||||||
if (launcherName == LauncherName.CALENDAR) {
|
|
||||||
LauncherName.CALENDULA
|
|
||||||
} else {
|
|
||||||
LauncherName.CALENDAR
|
|
||||||
},
|
|
||||||
)
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (showAppName) {
|
||||||
|
OptionPicker(
|
||||||
|
title = stringResource(R.string.settings_app_name),
|
||||||
|
predictiveBack = true,
|
||||||
|
options = LauncherName.entries,
|
||||||
|
selected = launcherName,
|
||||||
|
label = { launcherNameLabel(it) },
|
||||||
|
onSelect = viewModel::setLauncherName,
|
||||||
|
onDismiss = { showAppName = false },
|
||||||
|
// Explain what changes (and the icon-may-move caveat) above the choices.
|
||||||
|
header = { SettingsHint(stringResource(R.string.settings_app_name_summary)) },
|
||||||
|
)
|
||||||
|
}
|
||||||
if (showTheme) {
|
if (showTheme) {
|
||||||
OptionPicker(
|
OptionPicker(
|
||||||
title = stringResource(R.string.settings_theme),
|
title = stringResource(R.string.settings_theme),
|
||||||
@@ -1736,6 +1733,15 @@ private fun openUrl(context: Context, url: String) {
|
|||||||
runCatching { context.startActivity(intent) }
|
runCatching { context.startActivity(intent) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The display name for a launcher-label choice (issue #44). */
|
||||||
|
@Composable
|
||||||
|
private fun launcherNameLabel(name: LauncherName): String = stringResource(
|
||||||
|
when (name) {
|
||||||
|
LauncherName.CALENDULA -> R.string.app_name
|
||||||
|
LauncherName.CALENDAR -> R.string.app_name_calendar_alias
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun themeLabel(mode: ThemeMode): String = stringResource(
|
private fun themeLabel(mode: ThemeMode): String = stringResource(
|
||||||
when (mode) {
|
when (mode) {
|
||||||
|
|||||||
Reference in New Issue
Block a user