Skip to content

Commit a507d2f

Browse files
committed
SES-4620 - setting our system bars to match our themes' light/dark value
1 parent b377640 commit a507d2f

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

app/src/main/java/org/thoughtcrime/securesms/ui/components/BottomSheets.kt

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,17 @@ import androidx.compose.material3.Text
2020
import androidx.compose.material3.rememberModalBottomSheetState
2121
import androidx.compose.material3.rememberStandardBottomSheetState
2222
import androidx.compose.runtime.Composable
23+
import androidx.compose.runtime.SideEffect
2324
import androidx.compose.ui.Alignment.Companion.CenterVertically
2425
import androidx.compose.ui.Modifier
26+
import androidx.compose.ui.platform.LocalView
2527
import androidx.compose.ui.res.painterResource
2628
import androidx.compose.ui.res.stringResource
2729
import androidx.compose.ui.text.style.TextAlign
2830
import androidx.compose.ui.tooling.preview.Preview
2931
import androidx.compose.ui.tooling.preview.PreviewParameter
32+
import androidx.compose.ui.window.DialogWindowProvider
33+
import androidx.core.view.WindowCompat
3034
import network.loki.messenger.R
3135
import org.thoughtcrime.securesms.ui.qaTag
3236
import org.thoughtcrime.securesms.ui.theme.LocalColors
@@ -58,9 +62,22 @@ fun BaseBottomSheet(
5862
topEnd = LocalDimensions.current.xsSpacing
5963
),
6064
dragHandle = dragHandle,
61-
containerColor = LocalColors.current.backgroundSecondary,
62-
content = content
63-
)
65+
containerColor = LocalColors.current.backgroundSecondary
66+
){
67+
// make sure the status and navigation bars follow our theme color's light vs dark
68+
val view = LocalView.current
69+
val isLight = LocalColors.current.isLight
70+
(view.parent as? DialogWindowProvider)?.window?.let { window ->
71+
SideEffect {
72+
// Set status bar color
73+
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = isLight
74+
// Set navigation bar color
75+
WindowCompat.getInsetsController(window, view).isAppearanceLightNavigationBars = isLight
76+
}
77+
}
78+
79+
content()
80+
}
6481
}
6582

6683

0 commit comments

Comments
 (0)