Skip to content

Commit a8820a4

Browse files
validcubeoSumAtrIX
authored andcommitted
fix: Transparent status on fullscreen dialog (#2654)
1 parent e127845 commit a8820a4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

app/src/main/java/app/revanced/manager/ui/component/FullscreenDialog.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package app.revanced.manager.ui.component
22

33
import android.view.WindowManager
4+
import androidx.compose.foundation.isSystemInDarkTheme
45
import androidx.compose.runtime.Composable
56
import androidx.compose.runtime.LaunchedEffect
67
import androidx.compose.ui.graphics.Color
@@ -9,6 +10,7 @@ import androidx.compose.ui.platform.LocalView
910
import androidx.compose.ui.window.Dialog
1011
import androidx.compose.ui.window.DialogProperties
1112
import androidx.compose.ui.window.DialogWindowProvider
13+
import androidx.core.view.WindowCompat
1214

1315
private val properties = DialogProperties(
1416
usePlatformDefaultWidth = false,
@@ -22,11 +24,17 @@ fun FullscreenDialog(onDismissRequest: () -> Unit, content: @Composable () -> Un
2224
onDismissRequest = onDismissRequest,
2325
properties = properties
2426
) {
25-
val window = (LocalView.current.parent as DialogWindowProvider).window
26-
LaunchedEffect(Unit) {
27+
val view = LocalView.current
28+
val isDarkTheme = isSystemInDarkTheme()
29+
LaunchedEffect(isDarkTheme) {
30+
val window = (view.parent as DialogWindowProvider).window
2731
window.statusBarColor = Color.Transparent.toArgb()
2832
window.navigationBarColor = Color.Transparent.toArgb()
2933
window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
34+
35+
val insetsController = WindowCompat.getInsetsController(window, view)
36+
insetsController.isAppearanceLightStatusBars = !isDarkTheme
37+
insetsController.isAppearanceLightNavigationBars = !isDarkTheme
3038
}
3139

3240
content()

0 commit comments

Comments
 (0)