mirror of
https://github.com/twinksoftware/Gearslip.git
synced 2026-11-11 08:12:26 +01:00
Keep the map loaded behind other screens
Leaving Home used to tear down the map's surface, so coming back showed black for a second or two while the nav app redrew. Home now stays composed under every other screen.
This commit is contained in:
1 parent
473c12ad8f
commit
f25eafcc48
1 file changed
+16
-1
@@ -18,6 +18,7 @@ import androidx.compose.foundation.layout.size
|
|||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.gestures.detectTapGestures
|
||||||
import androidx.compose.ui.graphics.lerp
|
import androidx.compose.ui.graphics.lerp
|
||||||
import androidx.compose.ui.graphics.Brush
|
import androidx.compose.ui.graphics.Brush
|
||||||
import androidx.compose.foundation.layout.widthIn
|
import androidx.compose.foundation.layout.widthIn
|
||||||
@@ -176,8 +177,20 @@ fun CarUi() {
|
|||||||
// Header navigation (breadcrumb trail) - off for now, kept to tweak later.
|
// Header navigation (breadcrumb trail) - off for now, kept to tweak later.
|
||||||
// BreadcrumbBar(navigator)
|
// BreadcrumbBar(navigator)
|
||||||
Box(Modifier.weight(1f).fillMaxWidth()) {
|
Box(Modifier.weight(1f).fillMaxWidth()) {
|
||||||
|
// Home never leaves the composition; other screens cover it. Dropping it
|
||||||
|
// would tear down the map's surface, and coming back would then show black
|
||||||
|
// while the nav app redrew on a new one.
|
||||||
|
CarHome()
|
||||||
|
if (screen != CarScreen.Home) {
|
||||||
|
Box(
|
||||||
|
Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(MaterialTheme.colorScheme.background)
|
||||||
|
// Keeps touches that miss this screen's controls off the map.
|
||||||
|
.pointerInput(Unit) { detectTapGestures { } },
|
||||||
|
) {
|
||||||
when (screen) {
|
when (screen) {
|
||||||
CarScreen.Home -> CarHome()
|
CarScreen.Home -> Unit
|
||||||
CarScreen.Apps -> CarLauncher()
|
CarScreen.Apps -> CarLauncher()
|
||||||
CarScreen.Media -> mediaApp?.let { MediaScreen(it) { navigator.back() } }
|
CarScreen.Media -> mediaApp?.let { MediaScreen(it) { navigator.back() } }
|
||||||
CarScreen.Browse -> BrowseAppScreen(navigator)
|
CarScreen.Browse -> BrowseAppScreen(navigator)
|
||||||
@@ -189,6 +202,8 @@ fun CarUi() {
|
|||||||
is CarScreen.Messages -> MessagesScreen(screen.packageName)
|
is CarScreen.Messages -> MessagesScreen(screen.packageName)
|
||||||
is CarScreen.App -> CarApps.find(screen.id)?.content?.invoke()
|
is CarScreen.App -> CarApps.find(screen.id)?.content?.invoke()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// The dashboard is already listing them, so it needs no popup.
|
// The dashboard is already listing them, so it needs no popup.
|
||||||
if (screen !is CarScreen.Notifications && screen != CarScreen.Dashboard) {
|
if (screen !is CarScreen.Notifications && screen != CarScreen.Dashboard) {
|
||||||
NotificationPopup(Modifier.align(Alignment.TopCenter))
|
NotificationPopup(Modifier.align(Alignment.TopCenter))
|
||||||
|
|||||||
Reference in new issue
Block a user