mirror of
https://github.com/twinksoftware/Gearslip.git
synced 2026-11-11 00:12:24 +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
+27
-12
@@ -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,18 +177,32 @@ 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()) {
|
||||||
when (screen) {
|
// Home never leaves the composition; other screens cover it. Dropping it
|
||||||
CarScreen.Home -> CarHome()
|
// would tear down the map's surface, and coming back would then show black
|
||||||
CarScreen.Apps -> CarLauncher()
|
// while the nav app redrew on a new one.
|
||||||
CarScreen.Media -> mediaApp?.let { MediaScreen(it) { navigator.back() } }
|
CarHome()
|
||||||
CarScreen.Browse -> BrowseAppScreen(navigator)
|
if (screen != CarScreen.Home) {
|
||||||
CarScreen.Settings -> CarSettingsScreen()
|
Box(
|
||||||
CarScreen.Dashboard -> CarDashboardScreen()
|
Modifier
|
||||||
CarScreen.Weather -> WeatherScreen()
|
.fillMaxSize()
|
||||||
CarScreen.VehicleData -> VehicleDataScreen()
|
.background(MaterialTheme.colorScheme.background)
|
||||||
is CarScreen.Notifications -> NotificationsScreen(screen.replyTo)
|
// Keeps touches that miss this screen's controls off the map.
|
||||||
is CarScreen.Messages -> MessagesScreen(screen.packageName)
|
.pointerInput(Unit) { detectTapGestures { } },
|
||||||
is CarScreen.App -> CarApps.find(screen.id)?.content?.invoke()
|
) {
|
||||||
|
when (screen) {
|
||||||
|
CarScreen.Home -> Unit
|
||||||
|
CarScreen.Apps -> CarLauncher()
|
||||||
|
CarScreen.Media -> mediaApp?.let { MediaScreen(it) { navigator.back() } }
|
||||||
|
CarScreen.Browse -> BrowseAppScreen(navigator)
|
||||||
|
CarScreen.Settings -> CarSettingsScreen()
|
||||||
|
CarScreen.Dashboard -> CarDashboardScreen()
|
||||||
|
CarScreen.Weather -> WeatherScreen()
|
||||||
|
CarScreen.VehicleData -> VehicleDataScreen()
|
||||||
|
is CarScreen.Notifications -> NotificationsScreen(screen.replyTo)
|
||||||
|
is CarScreen.Messages -> MessagesScreen(screen.packageName)
|
||||||
|
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) {
|
||||||
|
|||||||
Reference in new issue
Block a user