Skip to content

Commit e70a6a3

Browse files
InsetsController warning removed
1 parent 792b072 commit e70a6a3

File tree

1 file changed

+5
-3
lines changed
  • app/src/main/java/com/techlads/composetv/theme

1 file changed

+5
-3
lines changed

app/src/main/java/com/techlads/composetv/theme/Theme.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import androidx.compose.ui.graphics.toArgb
1818
import androidx.compose.ui.platform.LocalContext
1919
import androidx.compose.ui.platform.LocalView
2020
import androidx.compose.ui.unit.dp
21-
import androidx.core.view.ViewCompat
21+
import androidx.core.view.WindowCompat
2222

2323
private val DarkColorScheme = darkColorScheme(
2424
primary = Purple80,
@@ -59,8 +59,10 @@ fun Material3Theme(
5959
val view = LocalView.current
6060
if (!view.isInEditMode) {
6161
SideEffect {
62-
(view.context as Activity).window.statusBarColor = colorScheme.primary.toArgb()
63-
ViewCompat.getWindowInsetsController(view)?.isAppearanceLightStatusBars = darkTheme
62+
(view.context as? Activity)?.window?.run {
63+
statusBarColor = colorScheme.primary.toArgb()
64+
WindowCompat.getInsetsController(this, view).isAppearanceLightStatusBars = darkTheme
65+
}
6466
}
6567
}
6668

0 commit comments

Comments
 (0)