Skip to content

Commit bf309af

Browse files
committed
fix(splash): 修复部分系统启动页顶部异常显示应用名的问题 #491
1 parent 5aa5f46 commit bf309af

4 files changed

Lines changed: 28 additions & 7 deletions

File tree

ZalithLauncher/src/main/java/com/movtery/zalithlauncher/ui/activities/SplashActivity.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import android.os.Bundle
2626
import androidx.activity.compose.setContent
2727
import androidx.activity.viewModels
2828
import androidx.compose.foundation.layout.Box
29+
import androidx.compose.foundation.layout.fillMaxSize
30+
import androidx.compose.ui.Modifier
2931
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
3032
import androidx.lifecycle.lifecycleScope
3133
import com.movtery.zalithlauncher.SplashException
@@ -62,8 +64,8 @@ class SplashActivity : BaseComponentActivity(refreshData = false) {
6264
private val backStackViewModel: SplashBackStackViewModel by viewModels()
6365

6466
override fun onCreate(savedInstanceState: Bundle?) {
65-
super.onCreate(savedInstanceState)
6667
installSplashScreen()
68+
super.onCreate(savedInstanceState)
6769

6870
initUnpackItems()
6971
checkAllTask()
@@ -74,7 +76,9 @@ class SplashActivity : BaseComponentActivity(refreshData = false) {
7476

7577
setContent {
7678
ZalithLauncherTheme {
77-
Box {
79+
Box(
80+
modifier = Modifier.fillMaxSize()
81+
) {
7882
SplashScreen(
7983
startAllTask = { startAllTask() },
8084
unpackItems = unpackItems,

ZalithLauncher/src/main/java/com/movtery/zalithlauncher/ui/screens/splash/SplashScreen.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import androidx.compose.ui.Alignment
3535
import androidx.compose.ui.Modifier
3636
import androidx.compose.ui.graphics.Color
3737
import androidx.compose.ui.unit.dp
38-
import androidx.compose.ui.zIndex
3938
import androidx.navigation3.runtime.entryProvider
4039
import androidx.navigation3.ui.NavDisplay
4140
import com.movtery.zalithlauncher.components.InstallableItem
@@ -54,16 +53,21 @@ fun SplashScreen(
5453
unpackItems: List<InstallableItem>,
5554
screenViewModel: SplashBackStackViewModel
5655
) {
57-
Column {
56+
Column(
57+
modifier = Modifier.fillMaxSize()
58+
) {
5859
TopBar(
5960
modifier = Modifier
6061
.fillMaxWidth()
61-
.height(40.dp)
62-
.zIndex(10f),
62+
.height(40.dp),
6363
color = MaterialTheme.colorScheme.surfaceContainer
6464
)
6565

66-
Surface(modifier = Modifier.fillMaxSize().weight(1f)) {
66+
Surface(
67+
modifier = Modifier
68+
.weight(1f)
69+
.fillMaxWidth()
70+
) {
6771
NavigationUI(
6872
modifier = Modifier
6973
.fillMaxSize()

ZalithLauncher/src/main/res/values-night/themes.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,13 @@
44
<item name="android:windowFullscreen">true</item>
55
<item name="android:windowContentOverlay">@null</item>
66
</style>
7+
<style name="AppTheme.SplashScreen" parent="@style/Theme.SplashScreen">
8+
<item name="postSplashScreenTheme">@style/AppTheme.ZalithLauncher</item>
9+
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_launcher</item>
10+
<item name="windowSplashScreenAnimationDuration">200</item>
11+
<item name="windowActionBar">false</item>
12+
<item name="windowNoTitle">true</item>
13+
<item name="android:windowFullscreen">true</item>
14+
<item name="android:windowContentOverlay">@null</item>
15+
</style>
716
</resources>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@
88
<item name="postSplashScreenTheme">@style/AppTheme.ZalithLauncher</item>
99
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_launcher</item>
1010
<item name="windowSplashScreenAnimationDuration">200</item>
11+
<item name="windowActionBar">false</item>
12+
<item name="windowNoTitle">true</item>
13+
<item name="android:windowFullscreen">true</item>
14+
<item name="android:windowContentOverlay">@null</item>
1115
</style>
1216
</resources>

0 commit comments

Comments
 (0)