mirror of
https://github.com/SimpleMobileTools/Simple-Flashlight.git
synced 2025-06-05 21:59:19 +02:00
Clean up BrightDisplayActivity
method references
This commit is contained in:
@ -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)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user