Use background color in system bars

This commit is contained in:
Juha Heinanen
2025-04-09 17:15:40 +03:00
parent 0cab5d642b
commit b26c31f29c
3 changed files with 7 additions and 4 deletions
@@ -11,6 +11,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.SideEffect import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalView import androidx.compose.ui.platform.LocalView
import androidx.core.view.WindowCompat import androidx.core.view.WindowCompat
@@ -47,6 +48,8 @@ fun AppTheme(
// Handle the status bar appearance // Handle the status bar appearance
val insetsController = WindowCompat.getInsetsController(window, decorView) val insetsController = WindowCompat.getInsetsController(window, decorView)
window.statusBarColor = customColorsPalette.background.toArgb()
window.navigationBarColor = customColorsPalette.background.toArgb()
insetsController.apply { insetsController.apply {
isAppearanceLightStatusBars = !darkTheme.value isAppearanceLightStatusBars = !darkTheme.value
isAppearanceLightNavigationBars = !darkTheme.value isAppearanceLightNavigationBars = !darkTheme.value
@@ -150,7 +150,6 @@ class ChatActivity : ComponentActivity() {
keyboardController = LocalSoftwareKeyboardController.current keyboardController = LocalSoftwareKeyboardController.current
Surface( Surface(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
color = LocalCustomColors.current.background
) { ) {
ChatScreen(this, title) { goBack() } ChatScreen(this, title) { goBack() }
} }
@@ -167,6 +166,7 @@ class ChatActivity : ComponentActivity() {
.fillMaxHeight() .fillMaxHeight()
.imePadding() .imePadding()
.safeDrawingPadding(), .safeDrawingPadding(),
containerColor = LocalCustomColors.current.background,
topBar = { TopAppBar(ctx, title, navigateBack) }, topBar = { TopAppBar(ctx, title, navigateBack) },
bottomBar = { NewMessage(ctx, peerUri) }, bottomBar = { NewMessage(ctx, peerUri) },
content = { contentPadding -> content = { contentPadding ->
@@ -59,7 +59,7 @@ val light_red = Color(0xffff0000)
val light_traffic_green = Color(0xFF4CAF50) val light_traffic_green = Color(0xFF4CAF50)
val light_traffic_yellow = Color(0xFFFFEB3B) val light_traffic_yellow = Color(0xFFFFEB3B)
val light_traffic_red = Color(0xFFFF5722) val light_traffic_red = Color(0xFFFF5722)
val light_light = light_white val light_light = Color(0xfffcfcfc)
val light_dark = Color(0xFF383838) val light_dark = Color(0xFF383838)
val light_spinner_text = light_dark val light_spinner_text = light_dark
val light_spinner_dropdown = light_gray_light val light_spinner_dropdown = light_gray_light
@@ -67,10 +67,10 @@ val light_spinner_divider = light_gray
val light_item_text = light_black val light_item_text = light_black
val light_alert_text = light_black val light_alert_text = light_black
val light_codec = light_black val light_codec = light_black
val light_background = Color(0xfffcfcfc) val light_background = light_light
val light_textfield_background = light_gray_light val light_textfield_background = light_gray_light
val light_popup_background = light_secondary_dark val light_popup_background = light_secondary_dark
val light_alert = Color(0xff0ca1fd) // == light_primary val light_alert = light_primary
val light_actionbar = light_background val light_actionbar = light_background
val dark_primary = Color(0xff0073c9) val dark_primary = Color(0xff0073c9)