Skip to content

Commit 5af4f75

Browse files
committed
style: set custom status bar color for Android < 12
1 parent 0e91686 commit 5af4f75

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • android/app/src/main/java/com/httpsms/ui/theme

android/app/src/main/java/com/httpsms/ui/theme/Theme.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,13 @@ fun HttpSmsTheme(
6262
if (!view.isInEditMode) {
6363
SideEffect {
6464
val window = (view.context as Activity).window
65-
window.statusBarColor = colorScheme.primary.toArgb()
66-
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme
65+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
66+
window.statusBarColor = if (darkTheme) Color.Black.toArgb() else LogoGreen.toArgb()
67+
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = false
68+
} else {
69+
window.statusBarColor = colorScheme.primary.toArgb()
70+
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme
71+
}
6772
}
6873
}
6974

0 commit comments

Comments
 (0)