Skip to content

Commit 9fea2bc

Browse files
committed
Add background for status and navigation bar in widget configuration activities
1 parent 18c8bf3 commit 9fea2bc

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

app/src/main/kotlin/com/simplemobiletools/flashlight/activities/WidgetBrightDisplayConfigureActivity.kt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ import androidx.activity.compose.setContent
99
import androidx.activity.viewModels
1010
import androidx.annotation.ColorInt
1111
import androidx.compose.runtime.Composable
12+
import androidx.compose.runtime.DisposableEffect
1213
import androidx.compose.runtime.getValue
14+
import androidx.compose.ui.graphics.Color
1315
import androidx.lifecycle.compose.collectAsStateWithLifecycle
1416
import com.simplemobiletools.commons.compose.alert_dialog.rememberAlertDialogState
1517
import com.simplemobiletools.commons.compose.extensions.enableEdgeToEdgeSimple
18+
import com.simplemobiletools.commons.compose.system_ui_controller.rememberSystemUiController
1619
import com.simplemobiletools.commons.compose.theme.AppTheme
20+
import com.simplemobiletools.commons.compose.theme.SimpleTheme
21+
import com.simplemobiletools.commons.compose.theme.isLitWell
1722
import com.simplemobiletools.commons.dialogs.ColorPickerAlertDialog
23+
import com.simplemobiletools.commons.extensions.isUsingSystemDarkTheme
1824
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
1925
import com.simplemobiletools.flashlight.R
2026
import com.simplemobiletools.flashlight.activities.viewmodel.WidgetConfigureViewModel
@@ -37,9 +43,20 @@ class WidgetBrightDisplayConfigureActivity : ComponentActivity() {
3743
finish()
3844
}
3945

40-
enableEdgeToEdgeSimple()
4146
setContent {
4247
AppTheme {
48+
49+
val systemUiController = rememberSystemUiController()
50+
val surfaceColor = SimpleTheme.colorScheme.surface
51+
52+
DisposableEffect(systemUiController, !isUsingSystemDarkTheme(), surfaceColor) {
53+
systemUiController.setSystemBarsColor(
54+
color = surfaceColor,
55+
darkIcons = surfaceColor.isLitWell()
56+
)
57+
onDispose { }
58+
}
59+
4360
val widgetColor by viewModel.widgetColor.collectAsStateWithLifecycle()
4461
val widgetAlpha by viewModel.widgetAlpha.collectAsStateWithLifecycle()
4562

app/src/main/kotlin/com/simplemobiletools/flashlight/activities/WidgetTorchConfigureActivity.kt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@ import androidx.activity.compose.setContent
99
import androidx.activity.viewModels
1010
import androidx.annotation.ColorInt
1111
import androidx.compose.runtime.Composable
12+
import androidx.compose.runtime.DisposableEffect
1213
import androidx.compose.runtime.getValue
1314
import androidx.lifecycle.compose.collectAsStateWithLifecycle
1415
import com.simplemobiletools.commons.compose.alert_dialog.rememberAlertDialogState
1516
import com.simplemobiletools.commons.compose.extensions.enableEdgeToEdgeSimple
17+
import com.simplemobiletools.commons.compose.system_ui_controller.rememberSystemUiController
1618
import com.simplemobiletools.commons.compose.theme.AppTheme
19+
import com.simplemobiletools.commons.compose.theme.SimpleTheme
20+
import com.simplemobiletools.commons.compose.theme.isLitWell
1721
import com.simplemobiletools.commons.dialogs.ColorPickerAlertDialog
22+
import com.simplemobiletools.commons.extensions.isUsingSystemDarkTheme
1823
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
1924
import com.simplemobiletools.flashlight.R
2025
import com.simplemobiletools.flashlight.activities.viewmodel.WidgetConfigureViewModel
@@ -38,9 +43,20 @@ class WidgetTorchConfigureActivity : ComponentActivity() {
3843
finish()
3944
}
4045

41-
enableEdgeToEdgeSimple()
4246
setContent {
4347
AppTheme {
48+
49+
val systemUiController = rememberSystemUiController()
50+
val surfaceColor = SimpleTheme.colorScheme.surface
51+
52+
DisposableEffect(systemUiController, !isUsingSystemDarkTheme(), surfaceColor) {
53+
systemUiController.setSystemBarsColor(
54+
color = surfaceColor,
55+
darkIcons = surfaceColor.isLitWell()
56+
)
57+
onDispose { }
58+
}
59+
4460
val widgetColor by viewModel.widgetColor.collectAsStateWithLifecycle()
4561
val widgetAlpha by viewModel.widgetAlpha.collectAsStateWithLifecycle()
4662

0 commit comments

Comments
 (0)