mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-19 08:45:27 +02:00
Fixed switch settings item. Now it gives you new value on change instead of current value.
This commit is contained in:
parent
183c5d47a6
commit
19378fc7fc
@ -122,7 +122,7 @@ fun SettingsScreen(
|
||||
stringResource(R.string.send_usage_statistics),
|
||||
stringResource(R.string.send_usage_statistics_support),
|
||||
mainViewModel.enableAnalytics
|
||||
) { mainViewModel.updateEnableAnalytics(!it) }
|
||||
) { mainViewModel.updateEnableAnalytics(it) }
|
||||
}
|
||||
|
||||
// THIRD PARTY
|
||||
|
@ -119,7 +119,8 @@ fun SettingsListItem(
|
||||
* @param label Main text.
|
||||
* @param supportText Text that is located below label.
|
||||
* @param switchState Current switch state.
|
||||
* @param onSwitchChange Action to perform when user clicks on this component or just switch.
|
||||
* @param onSwitchChange Action to perform when user clicks on this component or just switch. Gives
|
||||
* you new value.
|
||||
*/
|
||||
@Composable
|
||||
fun SettingsListItem(
|
||||
@ -127,8 +128,8 @@ fun SettingsListItem(
|
||||
supportText: String? = null,
|
||||
switchState: Boolean,
|
||||
onSwitchChange: (Boolean) -> Unit
|
||||
) = BasicSettingsListItem(label, supportText, { onSwitchChange(switchState) }) {
|
||||
Switch(checked = switchState, onCheckedChange = { onSwitchChange(!it) })
|
||||
) = BasicSettingsListItem(label, supportText, { onSwitchChange(!switchState) }) {
|
||||
Switch(checked = switchState, onCheckedChange = { onSwitchChange(it) })
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,8 +61,8 @@ fun ThemesScreen(
|
||||
supportText = stringResource(R.string.enable_dynamic_colors_support),
|
||||
switchState = themmoController.isDynamicThemeEnabled,
|
||||
onSwitchChange = {
|
||||
themmoController.enableDynamicTheme(!it)
|
||||
viewModel.updateDynamicTheme(!it)
|
||||
themmoController.enableDynamicTheme(it)
|
||||
viewModel.updateDynamicTheme(it)
|
||||
}
|
||||
)
|
||||
}
|
||||
@ -78,8 +78,8 @@ fun ThemesScreen(
|
||||
supportText = stringResource(R.string.force_amoled_mode_support),
|
||||
switchState = themmoController.isAmoledThemeEnabled,
|
||||
onSwitchChange = {
|
||||
themmoController.enableAmoledTheme(!it)
|
||||
viewModel.updateAmoledTheme(!it)
|
||||
themmoController.enableAmoledTheme(it)
|
||||
viewModel.updateAmoledTheme(it)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user