mirror of
https://github.com/SimpleMobileTools/Simple-Flashlight.git
synced 2025-02-17 04:10:46 +01:00
Clean up BrightDisplayActivity
method references
This commit is contained in:
parent
59537d28bd
commit
34ac99fb63
@ -53,7 +53,7 @@ class BrightDisplayActivity : ComponentActivity() {
|
||||
ColorPicker()
|
||||
}
|
||||
|
||||
ScreenContent(colorPickerDialogState)
|
||||
ScreenContent(colorPickerDialogState::show)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -66,9 +66,7 @@ class BrightDisplayActivity : ComponentActivity() {
|
||||
alertDialogState = this,
|
||||
color = brightDisplayColor,
|
||||
removeDimmedBackground = true,
|
||||
onActiveColorChange = {
|
||||
viewModel.updateBackgroundColor(it)
|
||||
},
|
||||
onActiveColorChange = viewModel::updateBackgroundColor,
|
||||
onButtonPressed = { wasPositivePressed, color ->
|
||||
if (wasPositivePressed) {
|
||||
config.brightDisplayColor = color
|
||||
@ -82,7 +80,7 @@ class BrightDisplayActivity : ComponentActivity() {
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ScreenContent(colorPickerDialogState: AlertDialogState) {
|
||||
private fun ScreenContent(onChangeColorButtonPress: () -> Unit) {
|
||||
val backgroundColor by viewModel.backgroundColor.collectAsStateWithLifecycle()
|
||||
val contrastColor by remember { derivedStateOf { backgroundColor.getContrastColor() } }
|
||||
val timerVisible by viewModel.timerVisible.collectAsStateWithLifecycle()
|
||||
@ -90,9 +88,7 @@ class BrightDisplayActivity : ComponentActivity() {
|
||||
BrightDisplayScreen(
|
||||
backgroundColor = backgroundColor,
|
||||
contrastColor = contrastColor,
|
||||
onChangeColorPress = {
|
||||
colorPickerDialogState.show()
|
||||
},
|
||||
onChangeColorPress = onChangeColorButtonPress,
|
||||
sleepTimer = {
|
||||
AnimatedSleepTimer(timerText = timerText, timerVisible = timerVisible, onTimerClosePress = ::stopSleepTimer)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user