I'm migrating an app from xml to compose, I have a...
# compose
t
I'm migrating an app from xml to compose, I have a custom theme the created using compositionLocal, since I don't want to use system UI mode, I'm changing my theme manually following the custom theme... I have some view based UI that can't be replicated in compose so setting the theme manually breaks it by just sticking to the colorOnPrimary for light mode from the themes.xml I was able to do a force update by creating a new context everytime I change the theme and passing it to a context contextThemeWrapper
Copy code
val inNightMode = LocalNightMode.current
val context = LocalContext.current
val mContext = remember (inNightMode){ context.withForcedNightMode(inNightMode) }
val ctxThemeWrapper = remember(mContext) {
        ContextThemeWrapper(mContext,R.style.Theme_PROlauncher)
    }

AndroidView(factory = { ctx ->
    TextView(ctxThemeWrapper)
})
,...... so that's fixed too The app supports edge to edge, but I added some margin to the bottom of the composables to make it seem as if it's above the navigation bar and Now I have to set a translucent navigation Bar and change the navigation bar icon to based on the theme mode since that was part of the attributes in the themes.xml, and anytime I set the custom theme mode to light and toggle the nav bar icons based on this, instead of starting at the edge of the screen, the margins I added start from the top of the nav bar and also the transluscent bg becomes completely white
Copy code
val insetsController = WindowCompat.getInsetsController(window, window.decorView)
insetsController.isAppearanceLightNavigationBars = isLightTheme
the full method
Copy code
@Composable
fun ApplyEdgeToEdge(isLightTheme: Boolean) {
    val view = LocalView.current    val activity = view.context as Activity

    SideEffect {
        val window = activity.window

        // Ensure edge-to-edge layout
        WindowCompat.setDecorFitsSystemWindows(window, false)

        // Transparent system bars
        window.navigationBarColor = Color.Transparent.toArgb()

        // Disable nav bar contrast (API 29+)
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
            window.isNavigationBarContrastEnforced = false
        }

        // Optional (legacy translucent fallback)
        @Suppress("DEPRECATION")
        window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)

        // Control icons
        val insetsController = WindowCompat.getInsetsController(window, window.decorView)
        insetsController.isAppearanceLightNavigationBars = isLightTheme
    }
}
is there a way I could fix this???
🧵 1