Skip to content

Commit 67659dc

Browse files
committed
fix: sync activity background to theme
1 parent fa9067e commit 67659dc

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

app/src/main/kotlin/li/songe/gkd/ui/style/Theme.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import androidx.compose.runtime.getValue
2020
import androidx.compose.runtime.remember
2121
import androidx.compose.runtime.rememberCoroutineScope
2222
import androidx.compose.ui.graphics.Color
23+
import androidx.compose.ui.graphics.toArgb
2324
import androidx.core.view.WindowInsetsControllerCompat
2425
import kotlinx.coroutines.flow.MutableStateFlow
2526
import kotlinx.coroutines.flow.SharingStarted
@@ -72,6 +73,10 @@ fun AppTheme(
7273
isAppearanceLightStatusBars = !darkTheme
7374
}
7475
}
76+
val bg = colorScheme.background.toArgb()
77+
LaunchedEffect(darkTheme, bg) {
78+
activity.window.decorView.setBackgroundColor(bg)
79+
}
7580
}
7681

7782
val isTalkbackEnabledFlow = remember {

app/src/main/res/values/themes.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<resources>
22

3-
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar" />
3+
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar">
4+
<item name="android:windowBackground">@android:color/transparent</item>
5+
</style>
46

57
<style name="SplashScreenTheme" parent="Theme.SplashScreen">
68
<item name="windowSplashScreenAnimatedIcon">

0 commit comments

Comments
 (0)