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),
|
||||||
stringResource(R.string.send_usage_statistics_support),
|
stringResource(R.string.send_usage_statistics_support),
|
||||||
mainViewModel.enableAnalytics
|
mainViewModel.enableAnalytics
|
||||||
) { mainViewModel.updateEnableAnalytics(!it) }
|
) { mainViewModel.updateEnableAnalytics(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
// THIRD PARTY
|
// THIRD PARTY
|
||||||
|
@ -119,7 +119,8 @@ fun SettingsListItem(
|
|||||||
* @param label Main text.
|
* @param label Main text.
|
||||||
* @param supportText Text that is located below label.
|
* @param supportText Text that is located below label.
|
||||||
* @param switchState Current switch state.
|
* @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
|
@Composable
|
||||||
fun SettingsListItem(
|
fun SettingsListItem(
|
||||||
@ -127,8 +128,8 @@ fun SettingsListItem(
|
|||||||
supportText: String? = null,
|
supportText: String? = null,
|
||||||
switchState: Boolean,
|
switchState: Boolean,
|
||||||
onSwitchChange: (Boolean) -> Unit
|
onSwitchChange: (Boolean) -> Unit
|
||||||
) = BasicSettingsListItem(label, supportText, { onSwitchChange(switchState) }) {
|
) = BasicSettingsListItem(label, supportText, { onSwitchChange(!switchState) }) {
|
||||||
Switch(checked = switchState, onCheckedChange = { onSwitchChange(!it) })
|
Switch(checked = switchState, onCheckedChange = { onSwitchChange(it) })
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,8 +61,8 @@ fun ThemesScreen(
|
|||||||
supportText = stringResource(R.string.enable_dynamic_colors_support),
|
supportText = stringResource(R.string.enable_dynamic_colors_support),
|
||||||
switchState = themmoController.isDynamicThemeEnabled,
|
switchState = themmoController.isDynamicThemeEnabled,
|
||||||
onSwitchChange = {
|
onSwitchChange = {
|
||||||
themmoController.enableDynamicTheme(!it)
|
themmoController.enableDynamicTheme(it)
|
||||||
viewModel.updateDynamicTheme(!it)
|
viewModel.updateDynamicTheme(it)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -78,8 +78,8 @@ fun ThemesScreen(
|
|||||||
supportText = stringResource(R.string.force_amoled_mode_support),
|
supportText = stringResource(R.string.force_amoled_mode_support),
|
||||||
switchState = themmoController.isAmoledThemeEnabled,
|
switchState = themmoController.isAmoledThemeEnabled,
|
||||||
onSwitchChange = {
|
onSwitchChange = {
|
||||||
themmoController.enableAmoledTheme(!it)
|
themmoController.enableAmoledTheme(it)
|
||||||
viewModel.updateAmoledTheme(!it)
|
viewModel.updateAmoledTheme(it)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user