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
|
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.LocalTextStyle
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.ui.platform.LocalContext
|
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.LocalBasicFonts
|
||||||
import me.ash.reader.infrastructure.preference.LocalThemeIndex
|
import me.ash.reader.infrastructure.preference.LocalThemeIndex
|
||||||
import me.ash.reader.ui.theme.palette.LocalTonalPalettes
|
import me.ash.reader.ui.theme.palette.LocalTonalPalettes
|
||||||
@ -20,6 +24,22 @@ fun AppTheme(
|
|||||||
wallpaperPalettes: List<TonalPalettes> = extractTonalPalettesFromUserWallpaper(),
|
wallpaperPalettes: List<TonalPalettes> = extractTonalPalettesFromUserWallpaper(),
|
||||||
content: @Composable () -> Unit,
|
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 themeIndex = LocalThemeIndex.current
|
||||||
|
|
||||||
val tonalPalettes = wallpaperPalettes[
|
val tonalPalettes = wallpaperPalettes[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user