Add a first-launch guide

New users get a short swipeable tour on first launch; people who used the
app before are not shown it. It can be opened again from About.
This commit is contained in:
2026-11-17 20:55:11 +02:00
parent 0d64fa7409
commit cd2c7426ce
15 changed files with 438 additions and 3 deletions
@@ -6,11 +6,14 @@ import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.animation.Crossfade
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier
import cc.skysparkle.fogwave.ui.screens.HomeScreen
import cc.skysparkle.fogwave.ui.screens.Onboarding
import cc.skysparkle.fogwave.ui.screens.OnboardingScreen
import cc.skysparkle.fogwave.ui.theme.AppThemeState
import cc.skysparkle.fogwave.ui.theme.FogwaveTheme
@@ -18,6 +21,7 @@ class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
AppThemeState.load(this)
Onboarding.load(this)
enableEdgeToEdge(
statusBarStyle = SystemBarStyle.dark(Color.TRANSPARENT),
navigationBarStyle = SystemBarStyle.dark(Color.TRANSPARENT)
@@ -28,7 +32,11 @@ class MainActivity : ComponentActivity() {
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
HomeScreen()
// First-launch guide in place of the home screen; the player state lives in the
// activity's view model, so nothing is lost while the guide is open.
Crossfade(targetState = Onboarding.visible, label = "onboarding") { guide ->
if (guide) OnboardingScreen(onDone = { Onboarding.finish(this@MainActivity) }) else HomeScreen()
}
}
}
}