mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
feat: merge SteamVR and Cardboard into one VR drawer tab (#959)
This commit is contained in:
1 parent
91b02a9dda
commit
8b7a22e19e
38 files changed
+35
-120
No files matched your search
@@ -522,7 +522,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
}
|
||||
}
|
||||
LaunchedEffect(cardboard.enabled, steamVrSwitchedPicture, drawerOpen, drawerPage) {
|
||||
while (cardboard.enabled || steamVrSwitchedPicture || (drawerOpen && drawerPage == SessionDrawerPage.STEAMVR)) {
|
||||
while (cardboard.enabled || steamVrSwitchedPicture || (drawerOpen && drawerPage == SessionDrawerPage.VR)) {
|
||||
val now = kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.IO) {
|
||||
SteamVr.status(this@SessionActivity)
|
||||
}
|
||||
|
||||
@@ -5,8 +5,7 @@ internal enum class SessionDrawerPage(val firstControl: String) {
|
||||
SECOND_SCREEN("second-screen:none"),
|
||||
DISPLAY("hud"),
|
||||
EFFECTS("look"),
|
||||
STEAMVR("steamvr"),
|
||||
CARDBOARD("cardboard"),
|
||||
VR("steamvr"),
|
||||
GAMES("anisotropy"),
|
||||
SESSION("suspend"),
|
||||
}
|
||||
|
||||
@@ -42,8 +42,6 @@ import androidx.compose.material.icons.outlined.PictureInPictureAlt
|
||||
import androidx.compose.material.icons.automirrored.outlined.ExitToApp
|
||||
import androidx.compose.material.icons.outlined.Settings
|
||||
import androidx.compose.material.icons.outlined.SportsEsports
|
||||
import androidx.compose.material.icons.outlined.ViewInAr
|
||||
import androidx.compose.material.icons.outlined.Vrpano
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.RadioButton
|
||||
import androidx.compose.material3.RadioButtonDefaults
|
||||
@@ -153,8 +151,7 @@ private val SessionDrawerPage.title: Int get() = when (this) {
|
||||
SessionDrawerPage.CONTROLLER -> R.string.drawer_page_controller
|
||||
SessionDrawerPage.SECOND_SCREEN -> R.string.drawer_second_screen
|
||||
SessionDrawerPage.DISPLAY -> R.string.drawer_page_display
|
||||
SessionDrawerPage.STEAMVR -> R.string.steamvr_title
|
||||
SessionDrawerPage.CARDBOARD -> R.string.cardboard_title
|
||||
SessionDrawerPage.VR -> R.string.vr_title
|
||||
SessionDrawerPage.EFFECTS -> R.string.drawer_page_effects
|
||||
SessionDrawerPage.GAMES -> R.string.game_settings_title
|
||||
SessionDrawerPage.SESSION -> R.string.mode_session
|
||||
@@ -164,8 +161,7 @@ private val SessionDrawerPage.icon get() = when (this) {
|
||||
SessionDrawerPage.CONTROLLER -> Icons.Outlined.SportsEsports
|
||||
SessionDrawerPage.SECOND_SCREEN -> Icons.Outlined.ScreenShare
|
||||
SessionDrawerPage.DISPLAY -> Icons.Outlined.DesktopWindows
|
||||
SessionDrawerPage.STEAMVR -> Icons.Outlined.ViewInAr
|
||||
SessionDrawerPage.CARDBOARD -> Icons.Outlined.Vrpano
|
||||
SessionDrawerPage.VR -> VrHeadsetIcon
|
||||
SessionDrawerPage.EFFECTS -> Icons.Outlined.AutoFixHigh
|
||||
SessionDrawerPage.GAMES -> Icons.Outlined.Layers
|
||||
SessionDrawerPage.SESSION -> Icons.Outlined.Settings
|
||||
@@ -464,8 +460,10 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
|
||||
ScreenEffectsGroup(host, a, advancedEffectsExpanded,
|
||||
onAdvancedToggle = { advancedEffectsExpanded = !advancedEffectsExpanded }) { key -> focus.track(page, key) }
|
||||
}
|
||||
SessionDrawerPage.STEAMVR -> SteamVrGroup(a) { key -> focus.track(page, key) }
|
||||
SessionDrawerPage.CARDBOARD -> CardboardGroup(host, a) { key -> focus.track(page, key) }
|
||||
SessionDrawerPage.VR -> {
|
||||
SteamVrGroup(a) { key -> focus.track(page, key) }
|
||||
CardboardGroup(host, a) { key -> focus.track(page, key) }
|
||||
}
|
||||
SessionDrawerPage.CONTROLLER -> {
|
||||
SettingsGroup(stringResource(R.string.drawer_page_controller)) {
|
||||
a.padType?.let { type ->
|
||||
@@ -931,20 +929,18 @@ private fun SteamVrGroup(a: DrawerActions, track: (String) -> Modifier) {
|
||||
SettingsGroup(stringResource(R.string.steamvr_title)) {
|
||||
val vrLabel = stringResource(R.string.cardboard_steamvr)
|
||||
val enterLabel = stringResource(if (a.immersiveSteamVr) R.string.steamvr_enter else R.string.cardboard_steamvr_start)
|
||||
val enterHint = stringResource(if (a.immersiveSteamVr) R.string.steamvr_quest_ready_hint else R.string.cardboard_steamvr_ready_hint)
|
||||
@Composable fun button(label: String, hint: String?, text: String, action: String) {
|
||||
SettingsRow(label, hint) {
|
||||
@Composable fun button(label: String, text: String, action: String) {
|
||||
SettingsRow(label, null) {
|
||||
SecondaryButton(text, modifier = track("steamvr"), onClick = { a.onSteamVr(action) })
|
||||
}
|
||||
}
|
||||
when (a.steamVr) {
|
||||
SteamVr.Status.NOT_INSTALLED -> button(vrLabel, stringResource(R.string.cardboard_steamvr_install_hint),
|
||||
stringResource(R.string.cardboard_steamvr_install), "install")
|
||||
SteamVr.Status.NOT_INSTALLED -> button(vrLabel, stringResource(R.string.cardboard_steamvr_install), "install")
|
||||
SteamVr.Status.INSTALLING -> SettingsRow(vrLabel, stringResource(R.string.cardboard_steamvr_installing)) {}
|
||||
SteamVr.Status.READY -> button(vrLabel, enterHint, enterLabel, "start")
|
||||
SteamVr.Status.READY -> button(vrLabel, enterLabel, "start")
|
||||
SteamVr.Status.RUNNING -> {
|
||||
if (a.immersiveSteamVr) button(vrLabel, enterHint, enterLabel, "start")
|
||||
SettingsRow(vrLabel, stringResource(R.string.cardboard_steamvr_running_hint)) {
|
||||
if (a.immersiveSteamVr) button(vrLabel, enterLabel, "start")
|
||||
SettingsRow(vrLabel, null) {
|
||||
SecondaryButton(stringResource(R.string.cardboard_steamvr_stop),
|
||||
modifier = track(if (a.immersiveSteamVr) "steamvr-stop" else "steamvr"), onClick = { a.onSteamVr("stop") })
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.StrokeCap
|
||||
import androidx.compose.ui.graphics.StrokeJoin
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
internal val VrHeadsetIcon: ImageVector = ImageVector.Builder("VrHeadset", 24.dp, 24.dp, 24f, 24f).apply {
|
||||
for (d in listOf(
|
||||
"M5,8H19A3,3 0 0 1 22,11V15A3,3 0 0 1 19,18H15.6L14.1,15.6A2.4,2.4 0 0 0 9.9,15.6L8.4,18H5A3,3 0 0 1 2,15V11A3,3 0 0 1 5,8Z",
|
||||
"M7,8V6.5A1.5,1.5 0 0 1 8.5,5H15.5A1.5,1.5 0 0 1 17,6.5V8",
|
||||
)) addPath(addPathNodes(d), stroke = SolidColor(Color.Black), strokeLineWidth = 1.8f,
|
||||
strokeLineCap = StrokeCap.Round, strokeLineJoin = StrokeJoin.Round)
|
||||
}.build()
|
||||
Reference in new issue
Block a user