mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 06:15:58 +00:00
Glasses: Play SteamVR beside the glasses button instead of starting SteamVR with them, pad hands drawn as Index controllers and off while other VR controllers are connected, glasses sheet tabs sized like Steam's
This commit is contained in:
1 parent
b2beed6290
commit
b8fe2fbd88
27 files changed
+153
-56
No files matched your search
@@ -600,6 +600,7 @@ class MainActivity : ComponentActivity() {
|
||||
),
|
||||
FrontEndActions(
|
||||
onPlay = { startSteamSession() },
|
||||
onPlaySteamVr = { startSteamSession(steamVr = true) },
|
||||
// The client's desktop UI, with gamescope's Deck integration disabled.
|
||||
onPlayDesktopUi = {
|
||||
startSession(Intent(this, SessionActivity::class.java)
|
||||
@@ -926,8 +927,8 @@ class MainActivity : ComponentActivity() {
|
||||
if (SessionPrefs.runSteamAtStartup(this) && !isFinishing && !isDestroyed) startSteamSession()
|
||||
}
|
||||
|
||||
private fun startSteamSession() {
|
||||
startSession(Intent(this, SessionActivity::class.java), steamSession = true)
|
||||
private fun startSteamSession(steamVr: Boolean = false) {
|
||||
startSession(Intent(this, SessionActivity::class.java).putExtra(SessionActivity.EXTRA_STEAMVR, steamVr), steamSession = true)
|
||||
}
|
||||
|
||||
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||
|
||||
@@ -321,6 +321,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
private var glasses3dForVr = false
|
||||
private var glassesPresent = false
|
||||
private var steamVrAutoTried = false
|
||||
private var steamVrInstallTried = false
|
||||
private var headTracking by mutableStateOf(false)
|
||||
private var glassesSlot by mutableStateOf(0)
|
||||
private var glassesKey: List<Any?> = emptyList()
|
||||
@@ -425,6 +426,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
SessionState.programArgs = intent.getStringArrayExtra(SessionService.EXTRA_PROGRAM_ARGS)?.toList().orEmpty()
|
||||
SessionState.steamUi = intent.getStringExtra(SessionService.EXTRA_STEAM_UI)
|
||||
SessionState.steamUrl = intent.getStringExtra(SessionService.EXTRA_STEAM_URL)
|
||||
SessionState.steamVr = intent.getBooleanExtra(EXTRA_STEAMVR, false)
|
||||
} else if (intent.getBooleanExtra(EXTRA_STEAMVR, false) && SessionState.mode == SessionService.MODE_STEAM) {
|
||||
SessionState.steamVr = true
|
||||
}
|
||||
if (intent.action == SessionService.ACTION_AGENT_START) {
|
||||
SessionEvents.record("agent.start_requested", mapOf("mode" to SessionState.mode))
|
||||
@@ -2584,6 +2588,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
// Home/notification resumes must retain the external frontend's return destination.
|
||||
if (this.intent.getBooleanExtra(EXTRA_RETURN_HOME, false)) intent.putExtra(EXTRA_RETURN_HOME, true)
|
||||
setIntent(intent)
|
||||
if (intent.getBooleanExtra(EXTRA_STEAMVR, false) && SessionState.mode == SessionService.MODE_STEAM) {
|
||||
SessionState.steamVr = true
|
||||
steamVrAutoTried = false
|
||||
}
|
||||
if (intent.action == SessionService.ACTION_HOME_GUIDE) {
|
||||
handleHomeGuideIntent(intent)
|
||||
} else if (intent.action == SessionService.ACTION_RESUME) {
|
||||
@@ -2815,11 +2823,21 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
|
||||
private fun autoStartSteamVr(now: SteamVr.Status) {
|
||||
if (now == SteamVr.Status.RUNNING) steamVrAutoTried = true
|
||||
if (now != SteamVr.Status.READY || steamVrAutoTried || !glassesSettings.autoSteamVr || !glasses.canControl ||
|
||||
loading.visible || SessionState.mode != SessionService.MODE_STEAM) return
|
||||
steamVrAutoTried = true
|
||||
Log.i(TAG, "starting SteamVR for ${glasses.model}")
|
||||
steamVrAction("start")
|
||||
if (steamVrAutoTried || !SessionState.steamVr || !glasses.canControl || loading.visible ||
|
||||
SessionState.mode != SessionService.MODE_STEAM) return
|
||||
when (now) {
|
||||
SteamVr.Status.READY -> {
|
||||
steamVrAutoTried = true
|
||||
Log.i(TAG, "starting SteamVR for ${glasses.model}")
|
||||
steamVrAction("start")
|
||||
}
|
||||
SteamVr.Status.NOT_INSTALLED -> if (!steamVrInstallTried) {
|
||||
steamVrInstallTried = true
|
||||
Log.i(TAG, "installing SteamVR for ${glasses.model}")
|
||||
steamVrAction("install")
|
||||
}
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateGlassesScreen() {
|
||||
@@ -3012,6 +3030,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
|
||||
companion object {
|
||||
const val EXTRA_RETURN_HOME = "returnHome"
|
||||
const val EXTRA_STEAMVR = "steamVr"
|
||||
/** How long the leaving flood may take before the session closes without it. */
|
||||
private const val LEAVE_TIMEOUT_MS = 1_500L
|
||||
private const val TAG = "SessionActivity"
|
||||
|
||||
@@ -133,7 +133,6 @@ class AgentBridgeProvider : ContentProvider() {
|
||||
"screenWidthDm" -> g.setScreenWidthDm(number!!)
|
||||
"screenDistanceDm" -> g.setScreenDistanceDm(number!!)
|
||||
"vrFovDeg" -> g.setVrFovDeg(number!!)
|
||||
"autoSteamVr" -> g.setAutoSteamVr(on())
|
||||
"sbsSupport" -> g.setSbsSupport(number!!)
|
||||
else -> return error("INVALID_KEY", "Unknown glasses setting '$key'")
|
||||
}
|
||||
@@ -170,6 +169,7 @@ class AgentBridgeProvider : ContentProvider() {
|
||||
.put("steamUi", SessionState.steamUi ?: JSONObject.NULL)
|
||||
.put("steamUrl", SessionState.steamUrl ?: JSONObject.NULL)
|
||||
.put("suspended", SessionState.suspended)
|
||||
.put("steamVr", SessionState.steamVr)
|
||||
.put("pip", SessionState.pipActive)
|
||||
.put("firstFrame", SessionState.firstFrameSeen)
|
||||
.put("output", JSONArray().put(SessionState.outputSize.first).put(SessionState.outputSize.second))
|
||||
|
||||
@@ -98,6 +98,7 @@ class AgentStartActivity : Activity() {
|
||||
request.optString("steamUrl").takeIf { it.startsWith("steam://") }?.let {
|
||||
putExtra(SessionService.EXTRA_STEAM_URL, it)
|
||||
}
|
||||
if (request.optBoolean("steamVr")) putExtra(SessionActivity.EXTRA_STEAMVR, true)
|
||||
}
|
||||
}
|
||||
startActivity(sessionIntent)
|
||||
|
||||
@@ -74,7 +74,6 @@ data class GlassesSettings(
|
||||
val screenWidthDm: Int = 20,
|
||||
val screenDistanceDm: Int = 30,
|
||||
val vrFovDeg: Int = VR_FOV_DEFAULT,
|
||||
val autoSteamVr: Boolean = true,
|
||||
) {
|
||||
companion object {
|
||||
const val VR_FOV_MIN = 24
|
||||
@@ -204,7 +203,6 @@ object Glasses {
|
||||
fun setScreenWidthDm(dm: Int) = post { update { it.copy(screenWidthDm = dm.coerceIn(5, 200)) } }
|
||||
fun setScreenDistanceDm(dm: Int) = post { update { it.copy(screenDistanceDm = dm.coerceIn(5, 200)) } }
|
||||
fun setVrFovDeg(deg: Int) = post { update { it.copy(vrFovDeg = deg.coerceIn(GlassesSettings.VR_FOV_MIN, GlassesSettings.VR_FOV_MAX)) } }
|
||||
fun setAutoSteamVr(on: Boolean) = post { update { it.copy(autoSteamVr = on) } }
|
||||
|
||||
fun glassesDisplay(): Display? = _state.value.displayId.takeIf { it != Display.INVALID_DISPLAY }?.let { displays.getDisplay(it) }
|
||||
|
||||
@@ -260,7 +258,7 @@ object Glasses {
|
||||
.put("settings", JSONObject().put("refreshHz", g.refreshHz).put("sbsHz", g.sbsHz).put("sunblock", g.sunblock ?: JSONObject.NULL)
|
||||
.put("gameOnGlasses", g.gameOnGlasses).put("headTracking", g.headTracking).put("auto3d", g.auto3d)
|
||||
.put("picture3d", g.picture3d).put("screenWidthDm", g.screenWidthDm).put("screenDistanceDm", g.screenDistanceDm)
|
||||
.put("vrFovDeg", g.vrFovDeg).put("autoSteamVr", g.autoSteamVr))
|
||||
.put("vrFovDeg", g.vrFovDeg))
|
||||
}
|
||||
|
||||
fun recentFrames(): JSONArray = synchronized(frames) { JSONArray(frames.toList()) }
|
||||
@@ -553,7 +551,6 @@ object Glasses {
|
||||
screenWidthDm = p.getInt("screenWidthDm", 20),
|
||||
screenDistanceDm = p.getInt("screenDistanceDm", 30),
|
||||
vrFovDeg = p.getInt("vrFovDeg", GlassesSettings.VR_FOV_DEFAULT).coerceIn(GlassesSettings.VR_FOV_MIN, GlassesSettings.VR_FOV_MAX),
|
||||
autoSteamVr = p.getBoolean("autoSteamVr", true),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -569,7 +566,6 @@ object Glasses {
|
||||
putInt("screenWidthDm", s.screenWidthDm)
|
||||
putInt("screenDistanceDm", s.screenDistanceDm)
|
||||
putInt("vrFovDeg", s.vrFovDeg)
|
||||
putBoolean("autoSteamVr", s.autoSteamVr)
|
||||
}.apply()
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ object SessionEvents {
|
||||
SessionState.programArgs = emptyList()
|
||||
SessionState.steamUi = null
|
||||
SessionState.steamUrl = null
|
||||
SessionState.steamVr = false
|
||||
SessionState.firstFrameSeen = false
|
||||
SessionState.suspended = false
|
||||
}
|
||||
|
||||
@@ -58,6 +58,8 @@ object SessionState {
|
||||
var steamUi: String? = null
|
||||
@Volatile
|
||||
var steamUrl: String? = null
|
||||
@Volatile
|
||||
var steamVr = false
|
||||
/** A session the guest asked for (the desktop's Steam launchers): started by the activity once this one has ended. */
|
||||
var relaunch: android.content.Intent? = null
|
||||
/** HDR10 was asked for and the panel can show it: the compositor was told, and the session
|
||||
|
||||
@@ -194,6 +194,7 @@ internal fun BoxWithConstraintsScope.DropSheet(
|
||||
icon: ImageVector,
|
||||
tabs: List<Pair<String, String>>,
|
||||
covered: () -> Float = { 0f },
|
||||
beside: @Composable (enabled: Boolean) -> Unit = {},
|
||||
rows: @Composable (tab: String) -> Unit,
|
||||
) {
|
||||
val density = LocalDensity.current
|
||||
@@ -417,7 +418,7 @@ internal fun BoxWithConstraintsScope.DropSheet(
|
||||
if (k.keyCode == KeyEvent.KEYCODE_DPAD_DOWN) { if (k.action == KeyEvent.ACTION_DOWN) close(); true } else false
|
||||
},
|
||||
) {
|
||||
SheetChips(tabs.map { it.second }, state.tab, chipFocus) { i -> state.travel = if (i > state.tab) 1 else -1; state.tab = i }
|
||||
SheetChips(tabs.map { it.second }, state.tab, chipFocus, width = LocalSheetChipWidth.current, end = true) { i -> state.travel = if (i > state.tab) 1 else -1; state.tab = i }
|
||||
}
|
||||
val closeSource = remember { MutableInteractionSource() }
|
||||
val closeHot = rememberHot(closeSource)
|
||||
@@ -437,6 +438,16 @@ internal fun BoxWithConstraintsScope.DropSheet(
|
||||
val enabled = covered() < 0.5f
|
||||
val toggle = { if (state.open) close() else state.open = true }
|
||||
val sideInset = if (narrow) 20.dp else 44.dp
|
||||
val besideShown = enabled && !state.open && !state.shown
|
||||
val r1 = rest
|
||||
if (r1 != null && (besideShown || state.sink.value < 0.99f)) Box(
|
||||
Modifier
|
||||
.align(Alignment.TopEnd)
|
||||
.padding(top = sideInset, end = sideInset + with(density) { r1.width.toDp() } + 12.dp)
|
||||
.graphicsLayer { alpha = (1f - state.sink.value) * (1f - covered()) }
|
||||
.zIndex(2f)
|
||||
.focusProperties { canFocus = besideShown },
|
||||
) { beside(besideShown) }
|
||||
Box(
|
||||
Modifier
|
||||
.align(Alignment.TopEnd)
|
||||
|
||||
@@ -153,6 +153,7 @@ class FrontEndState(
|
||||
|
||||
class FrontEndActions(
|
||||
val onPlay: () -> Unit,
|
||||
val onPlaySteamVr: () -> Unit = {},
|
||||
val onPlayDesktopUi: () -> Unit,
|
||||
val onSteamGame: (Library.SteamGame) -> Unit,
|
||||
val onGameShortcut: (Library.SteamGame) -> Unit = {},
|
||||
|
||||
@@ -196,7 +196,7 @@ internal fun SetupPanel(
|
||||
),
|
||||
) {
|
||||
PageHeader(stringResource(R.string.setup_title)) {
|
||||
Box(Modifier.weight(1f)) { SheetChips(tabs, tab, chipFocus, pick) }
|
||||
Box(Modifier.weight(1f)) { SheetChips(tabs, tab, chipFocus, onPick = pick) }
|
||||
}
|
||||
Column(modifier = Modifier.weight(1f).fillMaxWidth().verticalScroll(rememberScrollState()).padding(bottom = 24.dp)) {
|
||||
when (tab) {
|
||||
|
||||
@@ -130,8 +130,6 @@ internal fun GlassesGroups(
|
||||
format = { String.format(Locale.US, "%.1f m", it / 10f) }, modifier = track("glasses-distance")) { Glasses.setScreenDistanceDm(it) }
|
||||
}
|
||||
steamVr()
|
||||
ToggleRow(host, "glasses-auto-steamvr", stringResource(R.string.glasses_auto_steamvr), stringResource(R.string.glasses_auto_steamvr_hint),
|
||||
s.autoSteamVr, chipModifier = track("glasses-auto-steamvr")) { Glasses.setAutoSteamVr(it) }
|
||||
SliderRow(stringResource(R.string.glasses_vr_fov), stringResource(R.string.glasses_vr_fov_hint), s.vrFovDeg,
|
||||
GlassesSettings.VR_FOV_MIN..GlassesSettings.VR_FOV_MAX, step = 1,
|
||||
format = { "$it°" }, modifier = track("glasses-vr-fov")) { Glasses.setVrFovDeg(it) }
|
||||
|
||||
@@ -54,6 +54,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.compositionLocalOf
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateMapOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
@@ -105,6 +106,7 @@ import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.IntOffset
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.isSpecified
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.util.lerp
|
||||
import com.droiddeck.launcher.R
|
||||
@@ -157,6 +159,13 @@ internal class SheetBeat(private val pieces: List<Animatable<Float, AnimationVec
|
||||
/** The sheet whose rows are being laid out, so each settings group can take its beat. */
|
||||
internal val LocalSheetBeat = staticCompositionLocalOf<SheetBeat?> { null }
|
||||
|
||||
internal val LocalSheetChipWidth = compositionLocalOf { Dp.Unspecified }
|
||||
|
||||
private val ChipGap = 6.dp
|
||||
|
||||
internal fun sheetChipWidth(row: Dp, count: Int): Dp =
|
||||
if (count > 0 && row / count >= 96.dp) (row - ChipGap * (count - 1)) / count else 0.dp
|
||||
|
||||
/** A settings group's piece of the sheet's entrance; nothing outside a sheet. */
|
||||
@Composable
|
||||
internal fun Modifier.sheetPiece(): Modifier {
|
||||
@@ -368,7 +377,7 @@ internal fun LiftHero(
|
||||
val lipFocus = remember { FocusRequester() }
|
||||
val settingsLabel = stringResource(R.string.drawer_page_settings)
|
||||
var lipFocused by remember { mutableStateOf(false) }
|
||||
val lipWanted = !open && (!shown || lipBack) && (playFocused || playHovered || touchOnly || lipFocused)
|
||||
val lipWanted = !open && (!shown || lipBack) && (playFocused || playHovered || touchOnly || lipFocused) && drop?.let { it.open || it.shown } != true
|
||||
LaunchedEffect(lipWanted) {
|
||||
if (lipWanted) {
|
||||
// Back from the sheet it comes straight away; otherwise a beat after Play has focus.
|
||||
@@ -507,6 +516,12 @@ internal fun LiftHero(
|
||||
// Play's raised place: its centre 3dp under the sheet's edge, same left inset.
|
||||
val raise = restRect?.let { (openTop + with(density) { 3.dp.toPx() } - buttonH / 2f) - it.top } ?: 0f
|
||||
travelPx[0] = (h - openTop).coerceAtLeast(1f)
|
||||
val pill = restRect?.translate(0f, raise)
|
||||
// What the sheet holds: the chips to the right of Play, the rows under them.
|
||||
val chipsX = with(density) {
|
||||
if (narrow || pill == null) 16.dp.toPx() else pill.right + 20.dp.toPx() - inset
|
||||
}
|
||||
val chipWidth = with(density) { sheetChipWidth((w - 2 * inset - chipsX - 64.dp.toPx()).coerceAtLeast(0f).toDp(), tabs.size) }
|
||||
|
||||
// The wall behind sinks back about the pane's centre.
|
||||
val foot = h
|
||||
@@ -532,7 +547,6 @@ internal fun LiftHero(
|
||||
val rimPath = remember { Path() }
|
||||
val corner = with(density) { SheetCorner.toPx() }
|
||||
val rim = with(density) { 1.4.dp.toPx() }
|
||||
val pill = restRect?.translate(0f, raise)
|
||||
Canvas(Modifier.fillMaxSize()) {
|
||||
val f = fold.value
|
||||
val ft = foldTop.value
|
||||
@@ -560,10 +574,6 @@ internal fun LiftHero(
|
||||
drawPath(rimPath, rimColor, style = Stroke(rim))
|
||||
}
|
||||
}
|
||||
// What the sheet holds: the chips to the right of Play, the rows under them.
|
||||
val chipsX = with(density) {
|
||||
if (narrow || pill == null) 16.dp.toPx() else pill.right + 20.dp.toPx() - sheetLeft
|
||||
}
|
||||
val chipsY = with(density) { if (narrow && pill != null) (pill.bottom - openTop) + 10.dp.toPx() else ChipsTop.toPx() }
|
||||
// The rows start under the chips, which are 44dp to touch: from 54dp they ran under the
|
||||
// chips' feet and, scrolled, covered them.
|
||||
@@ -656,7 +666,7 @@ internal fun LiftHero(
|
||||
Box(
|
||||
Modifier
|
||||
.onGloballyPositioned { rest = it.boundsInRoot() }
|
||||
.graphicsLayer { translationY = raise * ride.value }
|
||||
.graphicsLayer { translationY = raise * ride.value; alpha = 1f - (drop?.sink?.value ?: 0f) }
|
||||
.onFocusChanged {
|
||||
// Left out of the sheet (from the chips or a row) folds it, as Up from the chips does.
|
||||
if (it.hasFocus && leftForPlay[0]) { leftForPlay[0] = false; if (openState.value && !launchingState.value) close() }
|
||||
@@ -702,7 +712,7 @@ internal fun LiftHero(
|
||||
Modifier
|
||||
.offset { IntOffset((r0.center.x - handleW / 2f).roundToInt(), (r0.bottom + raise * ride.value + (lipShow.value - 1f) * 8.dp.toPx()).roundToInt()) }
|
||||
.onSizeChanged { handleW = it.width.toFloat() }
|
||||
.graphicsLayer { alpha = lipShow.value * (1f - lipGone.value) }
|
||||
.graphicsLayer { alpha = lipShow.value * (1f - lipGone.value) * (1f - (drop?.sink?.value ?: 0f)) }
|
||||
// 44dp to touch, with a 32dp visible handle.
|
||||
.heightIn(min = 44.dp).testTag("sheet-open")
|
||||
.semantics { contentDescription = settingsLabel }
|
||||
@@ -717,7 +727,7 @@ internal fun LiftHero(
|
||||
}
|
||||
}
|
||||
}
|
||||
overlay { sink.value }
|
||||
CompositionLocalProvider(LocalSheetChipWidth provides chipWidth) { overlay { sink.value } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -785,7 +795,14 @@ private fun Modifier.drawBorderSidesAndFoot(color: Color, corner: Dp, flip: Bool
|
||||
*/
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
internal fun SheetChips(labels: List<String>, selected: Int, focus: List<FocusRequester>? = null, onPick: (Int) -> Unit) {
|
||||
internal fun SheetChips(
|
||||
labels: List<String>,
|
||||
selected: Int,
|
||||
focus: List<FocusRequester>? = null,
|
||||
width: Dp = Dp.Unspecified,
|
||||
end: Boolean = false,
|
||||
onPick: (Int) -> Unit,
|
||||
) {
|
||||
val pal = LocalPalette.current
|
||||
val bounds = remember { mutableStateMapOf<Int, Rect>() }
|
||||
val tint = rememberUpdatedState(pal.signal)
|
||||
@@ -794,20 +811,24 @@ internal fun SheetChips(labels: List<String>, selected: Int, focus: List<FocusRe
|
||||
var within by remember { mutableStateOf(false) }
|
||||
// LB / RB with a pad on the chips: focus goes with the selection.
|
||||
LaunchedEffect(selected) { if (within) runCatching { chips[selected].requestFocus() } }
|
||||
BoxWithConstraints(Modifier.fillMaxWidth().onFocusChanged { within = it.hasFocus }) {
|
||||
val equal = maxWidth / labels.size.coerceAtLeast(1) >= 96.dp
|
||||
BoxWithConstraints(
|
||||
Modifier.fillMaxWidth().onFocusChanged { within = it.hasFocus },
|
||||
contentAlignment = if (end) Alignment.CenterEnd else Alignment.CenterStart,
|
||||
) {
|
||||
val equal = !width.isSpecified && maxWidth / labels.size.coerceAtLeast(1) >= 96.dp
|
||||
val least = if (width.isSpecified) maxOf(width, 64.dp) else 64.dp
|
||||
val scroll = rememberScrollState()
|
||||
// Room inside the scroll for the focus ring, which the scroll's clip would otherwise cut.
|
||||
Box(if (equal) Modifier.fillMaxWidth() else Modifier.edgeFade(scroll).horizontalScroll(scroll).padding(3.dp)) {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(ChipGap),
|
||||
// Up from the rows lands on the picked chip, not whichever sits above: landing picks.
|
||||
modifier = (if (equal) Modifier.fillMaxWidth() else Modifier)
|
||||
.focusProperties { enter = { chips.getOrNull(selected) ?: FocusRequester.Default } }
|
||||
.focusGroup(),
|
||||
) {
|
||||
labels.forEachIndexed { i, label ->
|
||||
val m = (if (equal) Modifier.weight(1f) else Modifier.widthIn(min = 64.dp))
|
||||
val m = (if (equal) Modifier.weight(1f) else Modifier.widthIn(min = least))
|
||||
.onGloballyPositioned { bounds[i] = it.boundsInParent() }
|
||||
.focusRequester(chips[i])
|
||||
SheetChip(label, i == selected, m.onFocusChanged { if (it.isFocused && i != selected) onPick(i) }) { onPick(i) }
|
||||
|
||||
@@ -110,7 +110,13 @@ internal fun SteamHome(s: FrontEndState, a: FrontEndActions, modifier: Modifier)
|
||||
key = "steam", tabs = tabs,
|
||||
drop = drop.takeIf { glasses.present },
|
||||
overlay = { lifted ->
|
||||
if (glasses.present) DropSheet(drop, glasses.model, GlassesIcon, glassesTabs(glasses), covered = lifted) { tab ->
|
||||
if (glasses.present) DropSheet(
|
||||
drop, glasses.model, GlassesIcon, glassesTabs(glasses), covered = lifted,
|
||||
beside = { enabled ->
|
||||
PrimaryButton(stringResource(R.string.games_play_steamvr), enabled = !s.busy, large = true, icon = Icons.Filled.PlayArrow,
|
||||
modifier = Modifier.testTag("play-steamvr")) { if (enabled) a.onPlaySteamVr() }
|
||||
},
|
||||
) { tab ->
|
||||
GlassesGroups(rememberMenuHost(), glasses, glassesSettings, inSession = false, tab = tab)
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user