Fix colored status bar on full-screen dialogs.

This commit is contained in:
Alex Hart
2026-09-09 16:44:26 -04:00
committed by Cody Henthorne
parent 406be67a6f
commit 1e5b7868fd
@@ -34,16 +34,17 @@ fun Window.initializeScreenshotSecurity() {
*
* Bar icon appearance (`windowLightStatusBar` / `windowLightNavigationBar`) is left to the window's theme,
* which stays honored under edge-to-edge.
*
* The bar colors are cleared on every API level, including 35+. The platform only forces them transparent
* for windows it treats as edge-to-edge enforced, and that is not reliable for dialog windows, which
* otherwise keep the theme's `android:statusBarColor` (`?attr/colorPrimaryDark`) and paint a colored bar over
* our content. androidx.activity's own API 35 path clears both for the same reason; where the platform really
* does enforce edge-to-edge the setters are simply no-ops.
*/
@Suppress("DEPRECATION")
fun Window.enableEdgeToEdge() {
WindowCompat.setDecorFitsSystemWindows(this, false)
if (Build.VERSION.SDK_INT >= 35) {
// Edge-to-edge is enforced, which forces the bars transparent and makes both setters no-ops.
return
}
statusBarColor = Color.TRANSPARENT
navigationBarColor = when {
Build.VERSION.SDK_INT >= 29 -> Color.TRANSPARENT