Clean up `BrightDisplayActivity` method references

This commit is contained in:
Ensar Sarajčić 2023-10-05 12:29:37 +02:00
parent 59537d28bd
commit 34ac99fb63
1 changed files with 4 additions and 8 deletions

View File

@ -53,7 +53,7 @@ class BrightDisplayActivity : ComponentActivity() {
ColorPicker() ColorPicker()
} }
ScreenContent(colorPickerDialogState) ScreenContent(colorPickerDialogState::show)
} }
} }
} }
@ -66,9 +66,7 @@ class BrightDisplayActivity : ComponentActivity() {
alertDialogState = this, alertDialogState = this,
color = brightDisplayColor, color = brightDisplayColor,
removeDimmedBackground = true, removeDimmedBackground = true,
onActiveColorChange = { onActiveColorChange = viewModel::updateBackgroundColor,
viewModel.updateBackgroundColor(it)
},
onButtonPressed = { wasPositivePressed, color -> onButtonPressed = { wasPositivePressed, color ->
if (wasPositivePressed) { if (wasPositivePressed) {
config.brightDisplayColor = color config.brightDisplayColor = color
@ -82,7 +80,7 @@ class BrightDisplayActivity : ComponentActivity() {
} }
@Composable @Composable
private fun ScreenContent(colorPickerDialogState: AlertDialogState) { private fun ScreenContent(onChangeColorButtonPress: () -> Unit) {
val backgroundColor by viewModel.backgroundColor.collectAsStateWithLifecycle() val backgroundColor by viewModel.backgroundColor.collectAsStateWithLifecycle()
val contrastColor by remember { derivedStateOf { backgroundColor.getContrastColor() } } val contrastColor by remember { derivedStateOf { backgroundColor.getContrastColor() } }
val timerVisible by viewModel.timerVisible.collectAsStateWithLifecycle() val timerVisible by viewModel.timerVisible.collectAsStateWithLifecycle()
@ -90,9 +88,7 @@ class BrightDisplayActivity : ComponentActivity() {
BrightDisplayScreen( BrightDisplayScreen(
backgroundColor = backgroundColor, backgroundColor = backgroundColor,
contrastColor = contrastColor, contrastColor = contrastColor,
onChangeColorPress = { onChangeColorPress = onChangeColorButtonPress,
colorPickerDialogState.show()
},
sleepTimer = { sleepTimer = {
AnimatedSleepTimer(timerText = timerText, timerVisible = timerVisible, onTimerClosePress = ::stopSleepTimer) AnimatedSleepTimer(timerText = timerText, timerVisible = timerVisible, onTimerClosePress = ::stopSleepTimer)
} }