mirror of https://github.com/Ashinch/ReadYou.git
fix(ui): update the status bar icons to match the current theme
This commit is contained in:
parent
bddc8766ec
commit
de9986c2e7
|
@ -1,10 +1,14 @@
|
|||
package me.ash.reader.ui.theme
|
||||
|
||||
import android.os.Build
|
||||
import android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS
|
||||
import androidx.compose.material3.LocalTextStyle
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import me.ash.reader.infrastructure.preference.LocalBasicFonts
|
||||
import me.ash.reader.infrastructure.preference.LocalThemeIndex
|
||||
import me.ash.reader.ui.theme.palette.LocalTonalPalettes
|
||||
|
@ -20,6 +24,22 @@ fun AppTheme(
|
|||
wallpaperPalettes: List<TonalPalettes> = extractTonalPalettesFromUserWallpaper(),
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
val view = LocalView.current
|
||||
|
||||
LaunchedEffect(useDarkTheme) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
if (useDarkTheme) {
|
||||
view.windowInsetsController?.setSystemBarsAppearance(
|
||||
0, APPEARANCE_LIGHT_STATUS_BARS
|
||||
)
|
||||
} else {
|
||||
view.windowInsetsController?.setSystemBarsAppearance(
|
||||
APPEARANCE_LIGHT_STATUS_BARS, APPEARANCE_LIGHT_STATUS_BARS
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val themeIndex = LocalThemeIndex.current
|
||||
|
||||
val tonalPalettes = wallpaperPalettes[
|
||||
|
|
Loading…
Reference in New Issue