mirror of
https://github.com/twinksoftware/Gearslip.git
synced 2026-11-10 16:02:25 +01:00
Car apps opened from the launcher show no back arrow on their first screen, where the close button already is
This commit is contained in:
1 parent
dd6dd742b5
commit
be92ff0b3d
2 files changed
+11
No files matched your search
@@ -363,6 +363,10 @@ internal fun ActionButton(action: Action, large: Boolean = false, modifier: Modi
|
|||||||
AppIconBadge()
|
AppIconBadge()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// On an app's first screen, opened from the launcher, Gearslip's own close button is already
|
||||||
|
// the way out; a back arrow beside it did the same thing twice. Deeper in, it stays.
|
||||||
|
val atRoot by connection.atRoot.collectAsState()
|
||||||
|
if (action.type == Action.TYPE_BACK && atRoot && connection === CarServices.browse) return
|
||||||
val dark = MaterialTheme.colorScheme.surface.luminanceIsDark()
|
val dark = MaterialTheme.colorScheme.surface.luminanceIsDark()
|
||||||
val title = action.title.text()
|
val title = action.title.text()
|
||||||
val panOn by connection.panMode.collectAsState()
|
val panOn by connection.panMode.collectAsState()
|
||||||
|
|||||||
@@ -451,12 +451,19 @@ class CarAppConnection(private val context: Context, private val session: Sessio
|
|||||||
return@call
|
return@call
|
||||||
}
|
}
|
||||||
GearslipLog.i("host: template = ${template.javaClass.simpleName}")
|
GearslipLog.i("host: template = ${template.javaClass.simpleName}")
|
||||||
|
// The app's ScreenManager lists every screen on its stack; one or none is its first.
|
||||||
|
_atRoot.value = ((value as? TemplateWrapper)?.templateInfosForScreenStack?.size ?: 1) <= 1
|
||||||
_template.value = template
|
_template.value = template
|
||||||
update { it.copy(template = template.javaClass.simpleName) }
|
update { it.copy(template = template.javaClass.simpleName) }
|
||||||
autoRoute.onTemplate(template)
|
autoRoute.onTemplate(template)
|
||||||
}) { manager.getTemplate(it) }
|
}) { manager.getTemplate(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val _atRoot = MutableStateFlow(true)
|
||||||
|
|
||||||
|
/** True while the app shows its first screen, where its own back would only close it. */
|
||||||
|
val atRoot: StateFlow<Boolean> = _atRoot
|
||||||
|
|
||||||
private val _panMode = MutableStateFlow(false)
|
private val _panMode = MutableStateFlow(false)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in new issue
Block a user