From 48442c8d272e8d2a43bdbac3fa72ecd007ada0a8 Mon Sep 17 00:00:00 2001 From: T8RIN Date: Sat, 1 Apr 2023 20:01:00 +0300 Subject: [PATCH] - --- .../main_screen/components/ColorDialog.kt | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/ru/tech/imageresizershrinker/main_screen/components/ColorDialog.kt b/app/src/main/java/ru/tech/imageresizershrinker/main_screen/components/ColorDialog.kt index f0ef9e7b4e..598b726aee 100644 --- a/app/src/main/java/ru/tech/imageresizershrinker/main_screen/components/ColorDialog.kt +++ b/app/src/main/java/ru/tech/imageresizershrinker/main_screen/components/ColorDialog.kt @@ -46,13 +46,13 @@ fun ColorDialog( onColorChange: (ColorTuple) -> Unit, onDismissRequest: () -> Unit ) { - var _primary by rememberSaveable { mutableStateOf(colorTuple.primary.toArgb()) } - var _secondary by rememberSaveable { + var primary by rememberSaveable { mutableStateOf(colorTuple.primary.toArgb()) } + var secondary by rememberSaveable { mutableStateOf( colorTuple.secondary?.toArgb() ?: colorTuple.primary.calculateSecondaryColor() ) } - var _tertiary by rememberSaveable { + var tertiary by rememberSaveable { mutableStateOf( colorTuple.tertiary?.toArgb() ?: colorTuple.primary.calculateTertiaryColor() ) @@ -73,24 +73,24 @@ fun ColorDialog( Spacer(Modifier.height(8.dp)) TitleItem(text = stringResource(R.string.primary)) ColorCustomComponent( - color = _primary, + color = primary, onColorChange = { - _primary = it - _secondary = Color(it).calculateSecondaryColor() - _tertiary = Color(it).calculateTertiaryColor() + primary = it + secondary = Color(it).calculateSecondaryColor() + tertiary = Color(it).calculateTertiaryColor() } ) Divider() TitleItem(text = stringResource(R.string.secondary)) ColorCustomComponent( - color = _secondary, - onColorChange = { _secondary = it } + color = secondary, + onColorChange = { secondary = it } ) Divider() TitleItem(text = stringResource(R.string.tertiary)) ColorCustomComponent( - color = _tertiary, - onColorChange = { _tertiary = it } + color = tertiary, + onColorChange = { tertiary = it } ) Spacer(Modifier.height(8.dp)) } @@ -110,9 +110,9 @@ fun ColorDialog( onClick = { onColorChange( ColorTuple( - Color(_primary), - Color(_secondary), - Color(_tertiary) + Color(primary), + Color(secondary), + Color(tertiary) ) ) onDismissRequest()