After updating to Android Gradle plugin version 7.2.2 a warning is being given on the default Theme.kt file for Jetpack Compose projects:
ViewCompat.getWindowInsetsController is deprecated
This warning comes from a default implementation provided during Project Scaffolding:
/* snip */
val view = LocalView.current
if (!view.isInEditMode) {
SideEffect {
(view.context as Activity).window.statusBarColor = colorScheme.primary.toArgb()
ViewCompat.getWindowInsetsController(view)?.isAppearanceLightStatusBars = darkTheme // <--- This triggers a deprecation warning
}
}
Documentation recommends one to use the WindowCompat.getInsetsController instead - but that function needs access to both a view and a window.
Is there an easy path forward to resolve this Warning without ignoring it?