mirror of
https://github.com/twinksoftware/Gearslip.git
synced 2026-11-11 08:12:26 +01:00
Back in the car preview steps back in the car screens instead of closing the preview
This commit is contained in:
1 parent
cec98fcde6
commit
ef5365b9ed
1 file changed
+8
-5
@@ -226,11 +226,6 @@ private fun Fullscreen(
|
|||||||
onDispose { insets.show(WindowInsetsCompat.Type.systemBars()) }
|
onDispose { insets.show(WindowInsetsCompat.Type.systemBars()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Turning the phone back upright is what normally leaves fullscreen; back still leaves the
|
|
||||||
// preview screen entirely rather than doing nothing, in case the phone's own rotation lock
|
|
||||||
// is on and turning it sideways/back isn't an option.
|
|
||||||
BackHandler(onBack = onBack)
|
|
||||||
|
|
||||||
androidx.compose.foundation.layout.BoxWithConstraints(
|
androidx.compose.foundation.layout.BoxWithConstraints(
|
||||||
Modifier.fillMaxSize().background(Color.Black),
|
Modifier.fillMaxSize().background(Color.Black),
|
||||||
contentAlignment = Alignment.Center,
|
contentAlignment = Alignment.Center,
|
||||||
@@ -249,6 +244,14 @@ private fun Fullscreen(
|
|||||||
maxHeight - frameHeight >= room * 2 -> Alignment.TopStart
|
maxHeight - frameHeight >= room * 2 -> Alignment.TopStart
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
// Back steps back inside the car UI, as it does in a car, so one press no longer ends
|
||||||
|
// the preview and the drive's route with it. Leaving is the button beside the frame or
|
||||||
|
// turning the phone upright. A frame with no room for that button keeps back as the
|
||||||
|
// way out, in case the phone's rotation lock is on.
|
||||||
|
BackHandler {
|
||||||
|
if (corner == null) onBack()
|
||||||
|
else app.seb3thehacker.gearslip.car.CarKeys.onKey(android.view.KeyEvent.KEYCODE_BACK, down = true, longPress = false)
|
||||||
|
}
|
||||||
if (corner != null) {
|
if (corner != null) {
|
||||||
FilledTonalIconButton(
|
FilledTonalIconButton(
|
||||||
onClick = onBack,
|
onClick = onBack,
|
||||||
|
|||||||
Reference in new issue
Block a user