Skip to content

Commit

Permalink
Status bar theme fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Saifuddin53 committed Sep 20, 2024
1 parent fb29d83 commit 19c82ff
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@
*/
package org.mifos.mobile.core.designsystem.theme

import android.app.Activity
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalView
import androidx.core.view.WindowCompat

private val LightThemeColors = lightColorScheme(
primary = LightPrimary,
Expand Down Expand Up @@ -50,6 +55,15 @@ fun MifosMobileTheme(
else -> LightThemeColors
}

val view = LocalView.current
if (!view.isInEditMode) {
SideEffect {
val window = (view.context as Activity).window
window.statusBarColor = colors.primary.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !useDarkTheme
}
}

MaterialTheme(
colorScheme = colors,
content = content,
Expand Down

0 comments on commit 19c82ff

Please sign in to comment.