From 0000ecc50c7e982930bc78cb48021613141ae178 Mon Sep 17 00:00:00 2001 From: FunkyMuse Date: Mon, 24 Jul 2023 21:39:03 +0200 Subject: [PATCH] refactor: apply mr feedback --- .../compose/settings/SettingsCheckBoxComponent.kt | 11 +++++++++-- .../calculator/compose/theme/Theme.kt | 7 +++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calculator/compose/settings/SettingsCheckBoxComponent.kt b/app/src/main/kotlin/com/simplemobiletools/calculator/compose/settings/SettingsCheckBoxComponent.kt index 1298daa9..1446a9a2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calculator/compose/settings/SettingsCheckBoxComponent.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calculator/compose/settings/SettingsCheckBoxComponent.kt @@ -46,7 +46,11 @@ fun SettingsCheckBoxComponent( verticalAlignment = Alignment.CenterVertically, modifier = modifier .fillMaxWidth() - .clickable(onClick = { onChange?.invoke(!initialValue) }, interactionSource = interactionSource, indication = indication) + .clickable( + onClick = { onChange?.invoke(!initialValue) }, + interactionSource = interactionSource, + indication = indication + ) .padding(horizontal = 16.dp, vertical = 6.dp), ) { Column( @@ -77,7 +81,10 @@ fun SettingsCheckBoxComponent( checked = initialValue, onCheckedChange = { onChange?.invoke(it) }, enabled = isPreferenceEnabled, - colors = CheckboxDefaults.colors(checkedColor = checkboxColor, checkmarkColor = MaterialTheme.colorScheme.surface), + colors = CheckboxDefaults.colors( + checkedColor = checkboxColor, + checkmarkColor = MaterialTheme.colorScheme.surface + ), interactionSource = interactionSource ) } diff --git a/app/src/main/kotlin/com/simplemobiletools/calculator/compose/theme/Theme.kt b/app/src/main/kotlin/com/simplemobiletools/calculator/compose/theme/Theme.kt index e2300835..8f0241c6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calculator/compose/theme/Theme.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calculator/compose/theme/Theme.kt @@ -16,6 +16,7 @@ import com.google.accompanist.systemuicontroller.rememberSystemUiController import com.simplemobiletools.calculator.compose.theme.model.Theme import com.simplemobiletools.calculator.compose.theme.model.Theme.Companion.systemDefaultMaterialYou import com.simplemobiletools.calculator.extensions.config +import com.simplemobiletools.commons.helpers.isSPlus @Composable internal fun Theme( @@ -30,7 +31,7 @@ internal fun Theme( val colorScheme = if (!view.isInEditMode) { val colorScheme = when { - theme is Theme.SystemDefaultMaterialYou && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + theme is Theme.SystemDefaultMaterialYou && isSPlus() -> { if (isSystemInDarkTheme()) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) } @@ -58,7 +59,9 @@ internal fun Theme( colorScheme - } else darkColorScheme + } else { + darkColorScheme + } SideEffect { systemUiController.setNavigationBarColor(colorScheme.surface, navigationBarContrastEnforced = false)