diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a1c126962a..1ce7b0ac73 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -73,7 +73,7 @@ @@ -125,7 +125,7 @@ android:excludeFromRecents="true" android:noHistory="true" android:taskAffinity="${applicationId}.home" - android:screenOrientation="sensorLandscape" + android:screenOrientation="user" android:theme="@android:style/Theme.Translucent.NoTitleBar"> @@ -146,14 +146,14 @@ @@ -185,7 +185,7 @@ diff --git a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt index 077e9e96de..f7d514c49b 100644 --- a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt @@ -168,6 +168,7 @@ class FrontEndActivity : ComponentActivity() { private var picturePosition by mutableStateOf("center") private var stretch16x9 by mutableStateOf(false) private var orientation by mutableStateOf(android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE) + private var launcherOrientation by mutableStateOf(android.content.pm.ActivityInfo.SCREEN_ORIENTATION_USER) private var launcherFullscreen by mutableStateOf(true) private var downloadSource by mutableStateOf(DownloadSource.MODE_AUTO) private var downloadMirror by mutableStateOf("") @@ -775,7 +776,8 @@ class FrontEndActivity : ComponentActivity() { steamGamesX64 = cachedX64 backActionsInverted = SessionPrefs.backActionsInverted(this) orientation = SessionPrefs.orientation(this) - requestedOrientation = orientation + launcherOrientation = com.droiddeck.launcher.core.AppUiPrefs.orientation(this) + requestedOrientation = launcherOrientation launcherFullscreen = SessionPrefs.launcherFullscreen(this) downloadSource = DownloadSource.mode(this) downloadMirror = DownloadSource.mirror(this) @@ -844,6 +846,7 @@ class FrontEndActivity : ComponentActivity() { phantomProcessStatus = phantomProcessStatus, showPhantomGate = showPhantomGate, orientation = orientation, + launcherOrientation = launcherOrientation, launcherFullscreen = launcherFullscreen, downloadSource = downloadSource, downloadMirror = downloadMirror, @@ -1026,6 +1029,10 @@ class FrontEndActivity : ComponentActivity() { onOrientation = { value -> SessionPrefs.setOrientation(this, value) orientation = value + }, + onLauncherOrientation = { value -> + com.droiddeck.launcher.core.AppUiPrefs.setOrientation(this, value) + launcherOrientation = value requestedOrientation = value }, onLauncherFullscreen = { on -> @@ -1321,7 +1328,8 @@ class FrontEndActivity : ComponentActivity() { override fun onResume() { super.onResume() orientation = SessionPrefs.orientation(this) - requestedOrientation = orientation + launcherOrientation = com.droiddeck.launcher.core.AppUiPrefs.orientation(this) + requestedOrientation = launcherOrientation refreshWifiDiscovery() com.droiddeck.launcher.stores.StoresState.refresh(this) com.droiddeck.launcher.stores.StoresState.libraryListener = { refreshAddedGames(); refresh() } diff --git a/app/src/main/java/com/droiddeck/launcher/HomeActivity.kt b/app/src/main/java/com/droiddeck/launcher/HomeActivity.kt index 71304e8837..59e10c48e7 100644 --- a/app/src/main/java/com/droiddeck/launcher/HomeActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/HomeActivity.kt @@ -13,7 +13,7 @@ class HomeActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - requestedOrientation = com.droiddeck.launcher.session.SessionPrefs.orientation(this) + requestedOrientation = com.droiddeck.launcher.core.AppUiPrefs.orientation(this) routeHome() } diff --git a/app/src/main/java/com/droiddeck/launcher/core/AppUiPrefs.kt b/app/src/main/java/com/droiddeck/launcher/core/AppUiPrefs.kt index 3021b7196d..7b8536202d 100644 --- a/app/src/main/java/com/droiddeck/launcher/core/AppUiPrefs.kt +++ b/app/src/main/java/com/droiddeck/launcher/core/AppUiPrefs.kt @@ -1,11 +1,32 @@ package com.droiddeck.launcher.core import android.content.Context +import android.content.pm.ActivityInfo +import com.droiddeck.launcher.R object AppUiPrefs { const val DEFAULT_SCALE = 100 val scales = listOf(75, 85, 100, 115, 125, 150) + val orientationOptions = listOf( + ActivityInfo.SCREEN_ORIENTATION_USER to R.string.setup_launcher_orientation_auto, + ActivityInfo.SCREEN_ORIENTATION_PORTRAIT to R.string.setup_orientation_portrait, + ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE to R.string.setup_orientation_auto, + ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE to R.string.setup_orientation_landscape, + ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE to R.string.setup_orientation_reverse, + ) + + fun orientation(context: Context): Int = + context.getSharedPreferences("app-ui", Context.MODE_PRIVATE) + .getInt("orientation", ActivityInfo.SCREEN_ORIENTATION_USER) + .takeIf { value -> orientationOptions.any { it.first == value } } + ?: ActivityInfo.SCREEN_ORIENTATION_USER + + fun setOrientation(context: Context, value: Int) { + require(orientationOptions.any { it.first == value }) + context.getSharedPreferences("app-ui", Context.MODE_PRIVATE).edit().putInt("orientation", value).apply() + } + internal fun normalizeScale(percent: Int): Int = percent.takeIf { it in scales } ?: DEFAULT_SCALE fun scale(context: Context): Int = normalizeScale( diff --git a/app/src/main/java/com/droiddeck/launcher/files/FileManagerActivity.kt b/app/src/main/java/com/droiddeck/launcher/files/FileManagerActivity.kt index 1425a78e7e..873a413ad4 100644 --- a/app/src/main/java/com/droiddeck/launcher/files/FileManagerActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/files/FileManagerActivity.kt @@ -21,7 +21,7 @@ class FileManagerActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - requestedOrientation = com.droiddeck.launcher.session.SessionPrefs.orientation(this) + requestedOrientation = com.droiddeck.launcher.core.AppUiPrefs.orientation(this) if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { requestPermissions(arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), 1) } diff --git a/app/src/main/java/com/droiddeck/launcher/files/FileManagerScreen.kt b/app/src/main/java/com/droiddeck/launcher/files/FileManagerScreen.kt index 997a0e6da2..4ea75ab1ce 100644 --- a/app/src/main/java/com/droiddeck/launcher/files/FileManagerScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/files/FileManagerScreen.kt @@ -6,6 +6,8 @@ import android.widget.Toast import androidx.activity.compose.BackHandler import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.Image +import androidx.compose.foundation.horizontalScroll +import androidx.compose.foundation.rememberScrollState import android.content.res.Configuration import androidx.compose.foundation.background import androidx.compose.foundation.border @@ -21,6 +23,7 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width +import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.grid.GridCells @@ -668,6 +671,7 @@ fun FileManagerScreen( ) } + val compactToolbar = LocalConfiguration.current.screenWidthDp < 600 Column(modifier = Modifier.fillMaxSize()) { if (pickMode && !pickerTitle.isNullOrEmpty()) { Text( @@ -698,6 +702,7 @@ fun FileManagerScreen( modifier = Modifier .fillMaxWidth() .background(MaterialTheme.colorScheme.surfaceContainer) + .then(if (compactToolbar) Modifier.horizontalScroll(rememberScrollState()) else Modifier) .padding(horizontal = 8.dp, vertical = 6.dp), ) { IconButton(onClick = { requestNavigation(FileManagerNavigation.UP) }, enabled = canGoUp && !cancellingNavigation, modifier = Modifier.focusGlide(CircleShape)) { @@ -776,10 +781,10 @@ fun FileManagerScreen( fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis, - modifier = Modifier.weight(1f), + modifier = if (compactToolbar) Modifier.widthIn(max = 140.dp) else Modifier.weight(1f), ) } else if (LocalConfiguration.current.orientation == Configuration.ORIENTATION_PORTRAIT) { - Spacer(Modifier.weight(1f)) + if (!compactToolbar) Spacer(Modifier.weight(1f)) } else { Text( text = currentDir.name.ifBlank { currentDir.absolutePath }, @@ -788,7 +793,7 @@ fun FileManagerScreen( fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis, - modifier = Modifier.weight(1f), + modifier = if (compactToolbar) Modifier.widthIn(max = 140.dp) else Modifier.weight(1f), ) } @@ -928,13 +933,14 @@ fun FileManagerScreen( modifier = Modifier .fillMaxWidth() .background(MaterialTheme.colorScheme.primary.copy(alpha = 0.12f)) + .then(if (compactToolbar) Modifier.horizontalScroll(rememberScrollState()) else Modifier) .padding(horizontal = 12.dp, vertical = 6.dp), ) { Text( stringResource(R.string.fm_selected_count, selectedPaths.size), color = MaterialTheme.colorScheme.onBackground, fontSize = 13.sp, - modifier = Modifier.weight(1f), + modifier = if (compactToolbar) Modifier.padding(end = 12.dp) else Modifier.weight(1f), ) val allVisibleSelected = visibleEntries.isNotEmpty() && visibleEntries.all { it.absolutePath in selectedPaths } val anyVisibleSelected = visibleEntries.any { it.absolutePath in selectedPaths } diff --git a/app/src/main/java/com/droiddeck/launcher/files/FilePickerActivity.kt b/app/src/main/java/com/droiddeck/launcher/files/FilePickerActivity.kt index 498ec504e8..39a83e40e1 100644 --- a/app/src/main/java/com/droiddeck/launcher/files/FilePickerActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/files/FilePickerActivity.kt @@ -25,7 +25,7 @@ class FilePickerActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - requestedOrientation = com.droiddeck.launcher.session.SessionPrefs.orientation(this) + requestedOrientation = com.droiddeck.launcher.core.AppUiPrefs.orientation(this) if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { requestPermissions(arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), 1) } diff --git a/app/src/main/java/com/droiddeck/launcher/stores/StoreLoginActivity.kt b/app/src/main/java/com/droiddeck/launcher/stores/StoreLoginActivity.kt index 9a4f97c877..37169cf96f 100644 --- a/app/src/main/java/com/droiddeck/launcher/stores/StoreLoginActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/stores/StoreLoginActivity.kt @@ -88,6 +88,7 @@ class StoreLoginActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + requestedOrientation = com.droiddeck.launcher.core.AppUiPrefs.orientation(this) store = Store.byId(intent.getStringExtra(EXTRA_STORE)) clientUrl = intent.getStringExtra(EXTRA_CLIENT_URL)?.takeIf { store == Store.EPIC } oauthState = savedInstanceState?.getString(KEY_STATE) ?: generateState() diff --git a/app/src/main/java/com/droiddeck/launcher/stores/xbox/XboxLoginActivity.kt b/app/src/main/java/com/droiddeck/launcher/stores/xbox/XboxLoginActivity.kt index 10fc5ea71a..39840b2608 100644 --- a/app/src/main/java/com/droiddeck/launcher/stores/xbox/XboxLoginActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/stores/xbox/XboxLoginActivity.kt @@ -36,6 +36,7 @@ class XboxLoginActivity : ComponentActivity() { @SuppressLint("SetJavaScriptEnabled") override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + requestedOrientation = com.droiddeck.launcher.core.AppUiPrefs.orientation(this) host = LinearLayout(this).apply { orientation = LinearLayout.VERTICAL; setBackgroundColor(Color.BLACK) } status = TextView(this).apply { setTextColor(Color.WHITE); text = "Preparing Microsoft sign-in…"; setPadding(24, 16, 24, 16) } host.addView(status) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndRail.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndRail.kt index 7136ac7f07..78e6bd49bf 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndRail.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndRail.kt @@ -41,6 +41,9 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.horizontalScroll +import androidx.compose.foundation.relocation.BringIntoViewRequester +import androidx.compose.foundation.relocation.bringIntoViewRequester import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Apps @@ -87,6 +90,40 @@ import com.droiddeck.launcher.core.PhantomProcessLimit internal val AttentionAmber = Color(0xFFFFB547) +@Composable +internal fun BottomBar( + s: FrontEndState, selected: String, + onSelect: (String) -> Unit, onFocusSelect: (String) -> Unit, a: FrontEndActions, modifier: Modifier, +) { + val shown = Hops.railPreview ?: selected + val keys = navigationKeys(s) + val bounds = remember { androidx.compose.runtime.mutableStateMapOf() } + val tint = androidx.compose.runtime.rememberUpdatedState(LocalPalette.current.signal) + var barAt by remember { mutableStateOf(androidx.compose.ui.geometry.Offset.Zero) } + Row(modifier.fillMaxWidth().background(MaterialTheme.colorScheme.surface), verticalAlignment = Alignment.CenterVertically) { + BoxWithConstraints(Modifier.weight(1f)) { + val itemWidth = (maxWidth / keys.size).coerceIn(56.dp, 88.dp) + Box(Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()).onGloballyPositioned { barAt = it.boundsInRoot().topLeft }) { + if (shown in keys) ChipGlide(keys.indexOf(shown), bounds[shown]?.translate(-barAt), tint, GlideAxis.Horizontal, corner = 14.dp, fill = 0.14f, outline = 0f) + Row(Modifier.selectableGroup().padding(vertical = 4.dp), horizontalArrangement = Arrangement.Center) { + NavigationItems(s, shown, compact = true, iconOnly = false, height = 56.dp, width = itemWidth, + place = { key -> Modifier.onGloballyPositioned { bounds[key] = it.boundsInRoot(); Hops.railBounds[key] = it.boundsInRoot() } }, + onSelect = onSelect, onFocusSelect = onFocusSelect) + } + } + } + if (s.running != null) ResumeRailItem(s.running, compact = true, iconOnly = true, a.onResume) + } +} + +private fun navigationKeys(s: FrontEndState) = buildList { + add("steam"); add("games") + if (s.gameStoresEnabled) add("stores") + add("desktop"); add("components") + if (s.isHomeApp) add("android-apps") + add("setup"); add("updates") +} + @Composable internal fun SideRail( s: FrontEndState, selected: String, @@ -95,8 +132,6 @@ internal fun SideRail( val colors = MaterialTheme.colorScheme val compact = LocalConfiguration.current.screenHeightDp < 420 val iconOnly = isNarrowScreen() - val setupNeedsAttention = !s.ready || (s.available != null && s.available != s.installed) || - PhantomProcessLimit.blocksSteam(s.phantomProcessStatus) Column( horizontalAlignment = Alignment.CenterHorizontally, modifier = modifier.width(if (iconOnly) 64.dp else 92.dp).background(colors.surface).padding(vertical = if (compact) 8.dp else 12.dp), @@ -105,14 +140,7 @@ internal fun SideRail( BoxWithConstraints(Modifier.weight(1f).fillMaxWidth()) { val fit = (maxHeight / count - 4.dp).coerceIn(44.dp, if (iconOnly) 48.dp else if (compact) 52.dp else 60.dp) val shown = Hops.railPreview ?: selected - val keys = buildList { - add("steam"); add("games") - if (s.gameStoresEnabled) add("stores") - add("desktop") - add("components") - if (s.isHomeApp) add("android-apps") - add("setup"); add("updates") - } + val keys = navigationKeys(s) val bounds = remember { androidx.compose.runtime.mutableStateMapOf() } val tint = androidx.compose.runtime.rememberUpdatedState(LocalPalette.current.signal) var railAt by remember { mutableStateOf(androidx.compose.ui.geometry.Offset.Zero) } @@ -129,14 +157,7 @@ internal fun SideRail( Hops.railBounds[key] = it.boundsInRoot() } } - RailItem(stringResource(R.string.rail_steam), Icons.Outlined.SportsEsports, "steam", shown == "steam", compact, iconOnly, fit, place = place, onFocus = { onFocusSelect("steam") }) { onSelect("steam") } - RailItem(stringResource(R.string.rail_games), Icons.Outlined.VideoLibrary, "games", shown == "games", compact, iconOnly, fit, place = place, onFocus = { onFocusSelect("games") }) { onSelect("games") } - if (s.gameStoresEnabled) RailItem(stringResource(R.string.rail_stores), Icons.Outlined.LocalMall, "stores", shown == "stores", compact, iconOnly, fit, count = s.storeDownloadsActive, place = place, onFocus = { onFocusSelect("stores") }) { onSelect("stores") } - RailItem(stringResource(R.string.rail_desktop), Icons.Outlined.DesktopWindows, "desktop", shown == "desktop", compact, iconOnly, fit, place = place, onFocus = { onFocusSelect("desktop") }) { onSelect("desktop") } - RailItem(stringResource(R.string.rail_components), Icons.Outlined.Layers, "components", shown == "components", compact, iconOnly, fit, place = place, onFocus = { onFocusSelect("components") }) { onSelect("components") } - if (s.isHomeApp) RailItem(stringResource(R.string.rail_apps), Icons.Outlined.Apps, "android-apps", shown == "android-apps", compact, iconOnly, fit, place = place, onFocus = { onFocusSelect("android-apps") }) { onSelect("android-apps") } - RailItem(stringResource(R.string.rail_setup), Icons.Outlined.Tune, "setup", shown == "setup", compact, iconOnly, fit, badge = setupNeedsAttention, place = place, onFocus = { onFocusSelect("setup") }) { onSelect("setup") } - RailItem(stringResource(R.string.rail_updates), Icons.Outlined.SystemUpdate, "updates", shown == "updates", compact, iconOnly, fit, badge = s.updates.hasUpdate, place = place, onFocus = { onFocusSelect("updates") }) { onSelect("updates") } + NavigationItems(s, shown, compact, iconOnly, fit, if (iconOnly) 52.dp else 80.dp, place, onSelect, onFocusSelect) } } } @@ -151,8 +172,36 @@ internal fun SideRail( } @Composable +private fun NavigationItems( + s: FrontEndState, shown: String, compact: Boolean, iconOnly: Boolean, height: Dp, width: Dp, + place: (String) -> Modifier, onSelect: (String) -> Unit, onFocusSelect: (String) -> Unit, +) { + val setupNeedsAttention = !s.ready || (s.available != null && s.available != s.installed) || + PhantomProcessLimit.blocksSteam(s.phantomProcessStatus) + for (key in navigationKeys(s)) { + val (label, icon) = when (key) { + "steam" -> R.string.rail_steam to Icons.Outlined.SportsEsports + "games" -> R.string.rail_games to Icons.Outlined.VideoLibrary + "stores" -> R.string.rail_stores to Icons.Outlined.LocalMall + "desktop" -> R.string.rail_desktop to Icons.Outlined.DesktopWindows + "components" -> R.string.rail_components to Icons.Outlined.Layers + "android-apps" -> R.string.rail_apps to Icons.Outlined.Apps + "setup" -> R.string.rail_setup to Icons.Outlined.Tune + else -> R.string.rail_updates to Icons.Outlined.SystemUpdate + } + key(key) { + RailItem(stringResource(label), icon, key, shown == key, compact, iconOnly, height, width, + badge = (key == "setup" && setupNeedsAttention) || (key == "updates" && s.updates.hasUpdate), + count = if (key == "stores") s.storeDownloadsActive else 0, + place = place, onFocus = { onFocusSelect(key) }) { onSelect(key) } + } + } +} + +@Composable +@OptIn(androidx.compose.foundation.ExperimentalFoundationApi::class) private fun RailItem( - label: String, icon: ImageVector, key: String, current: Boolean, compact: Boolean, iconOnly: Boolean, height: Dp, + label: String, icon: ImageVector, key: String, current: Boolean, compact: Boolean, iconOnly: Boolean, height: Dp, width: Dp, badge: Boolean = false, count: Int = 0, place: (String) -> Modifier = { Modifier }, @@ -181,6 +230,8 @@ private fun RailItem( Motion.tw(220), label = "railFill", ) val scale by animateFloatAsState(if (pressed) 0.95f else 1f, Motion.sp(0.5f, Spring.StiffnessMedium), label = "railScale") + val bringIntoView = remember { BringIntoViewRequester() } + LaunchedEffect(current) { if (current) bringIntoView.bringIntoView() } Box( contentAlignment = Alignment.Center, modifier = Modifier @@ -189,7 +240,8 @@ private fun RailItem( .then(place(key)) .landingPop(Hops.railLanded[key] ?: 0) .graphicsLayer { scaleX = scale; scaleY = scale } - .size(width = if (iconOnly) 52.dp else 80.dp, height = height) + .size(width = width, height = height) + .bringIntoViewRequester(bringIntoView) .clip(Shape14) .background(fill) .glideBorder(focused, Shape14, pal.signal) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt index 66c2a8841e..4df261e8d2 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt @@ -11,6 +11,7 @@ import androidx.compose.foundation.focusGroup import androidx.compose.ui.focus.focusProperties import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.FocusDirection import androidx.compose.ui.focus.onFocusChanged import android.provider.Settings import android.view.Display @@ -138,6 +139,7 @@ class FrontEndState( val phantomProcessStatus: PhantomProcessStatus = PhantomProcessStatus.NOT_APPLICABLE, val showPhantomGate: Boolean = false, val orientation: Int = android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE, + val launcherOrientation: Int = android.content.pm.ActivityInfo.SCREEN_ORIENTATION_USER, val launcherFullscreen: Boolean = true, val downloadSource: String = DownloadSource.MODE_AUTO, val downloadMirror: String = "", @@ -219,6 +221,7 @@ class FrontEndActions( val onAppScale: (Int) -> Unit = {}, val onLauncherIcon: (String) -> Unit = {}, val onOrientation: (Int) -> Unit = {}, + val onLauncherOrientation: (Int) -> Unit = {}, val onLauncherFullscreen: (Boolean) -> Unit = {}, val onAnimationsEnabled: (Boolean) -> Unit = {}, val onDownloadSource: (String) -> Unit = {}, @@ -386,7 +389,12 @@ internal suspend fun focusSoon(target: () -> FocusRequester) { @Composable fun FrontEndScreen(s: FrontEndState, a: FrontEndActions, page: (@Composable () -> Unit)? = null) { val frontFocus = remember { FrontFocus() } - CompositionLocalProvider(LocalFrontFocus provides frontFocus) { FrontEndScreenBody(s, a, page, frontFocus) } + androidx.compose.foundation.layout.BoxWithConstraints(Modifier.fillMaxSize()) { + CompositionLocalProvider( + LocalFrontFocus provides frontFocus, + LocalNarrowPane provides (maxWidth < NarrowPaneWidth), + ) { FrontEndScreenBody(s, a, page, frontFocus) } + } } @OptIn(ExperimentalComposeUiApi::class) @@ -486,11 +494,12 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com val window = LocalWindowInfo.current val androidContext = androidx.compose.ui.platform.LocalContext.current var anyFocused by remember { mutableStateOf(false) } - Box( + androidx.compose.foundation.layout.BoxWithConstraints( modifier = Modifier.fillMaxSize().background(colors.background) .windowInsetsPadding(if (s.launcherFullscreen) WindowInsets.displayCutout else WindowInsets.systemBars) .onFocusChanged { anyFocused = it.hasFocus }, ) { + val bottomNavigation = maxHeight > maxWidth LaunchedEffect(processSettingsPageVisible) { if (processSettingsPageVisible) return@LaunchedEffect snapshotFlow { window.isWindowFocused }.first { it } @@ -527,10 +536,19 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com focusWithinFrames({ frontFocus.focusedRail == null && anyFocused }) { frontFocus.paneEntry() } } val paneFocus = Modifier - .focusProperties { enter = { frontFocus.paneEntry() } } + .focusProperties { + enter = { frontFocus.paneEntry() } + exit = { direction -> + if (bottomNavigation && direction == FocusDirection.Down) frontFocus.railFor(railSelection) + else FocusRequester.Default + } + } .focusGroup() val railFocus = Modifier - .focusProperties { enter = { frontFocus.railFor(railSelection) } } + .focusProperties { + enter = { frontFocus.railFor(railSelection) } + if (bottomNavigation) up = frontFocus.paneEntry() + } .focusGroup() LaunchedEffect(Hops.restore) { val r = Hops.restore ?: return@LaunchedEffect @@ -544,12 +562,16 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com } var screenAt by remember { mutableStateOf(Offset.Zero) } CompositionLocalProvider(LocalShowSection provides { key -> selected = key }) { - Row(modifier = Modifier.fillMaxSize().onGloballyPositioned { screenAt = it.positionInRoot() }) { - SideRail(s, railSelection, onRailSelect, onRailFocus, a, railFocus.fillMaxHeight()) - Box(Modifier.width(1.dp).fillMaxHeight().background(pal.line)) - Column(modifier = Modifier.weight(1f).fillMaxHeight()) { + LauncherLayout( + bottomNavigation, pal.line, + Modifier.fillMaxSize().onGloballyPositioned { screenAt = it.positionInRoot() }, + navigation = { + if (bottomNavigation) BottomBar(s, railSelection, onRailSelect, onRailFocus, a, railFocus) + else SideRail(s, railSelection, onRailSelect, onRailFocus, a, railFocus.fillMaxHeight()) + }, + ) { Pane( - s, selected, a, page, Modifier.weight(1f).fillMaxWidth().then(paneFocus), { selected = it }, + s, selected, a, page, Modifier.fillMaxSize().then(paneFocus), { selected = it }, onAndroidAppClick = { app -> if (s.secondScreenDisplays.isEmpty()) a.onAndroidApp(app, null) else appToChooseDisplay = app @@ -557,7 +579,6 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com onOpenDeveloperOptions = requestDeveloperOptions, onRequestWirelessAdb = requestWirelessAdbFix, ) - } } } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt index 1bf99f0697..43926aa6b1 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt @@ -398,7 +398,12 @@ internal fun SetupPanel( ActionRow(stringResource(R.string.setup_default_home), s.defaultHomeLabel ?: stringResource(R.string.setup_choose_home), stringResource(R.string.setup_choose), a.onHomeApp) } ChoiceRow( - host, "orientation", stringResource(R.string.setup_orientation), null, + host, "launcher-orientation", stringResource(R.string.setup_launcher_orientation), null, + com.droiddeck.launcher.core.AppUiPrefs.orientationOptions.map { (value, label) -> value to stringResource(label) }, + s.launcherOrientation, onPick = a.onLauncherOrientation, + ) + ChoiceRow( + host, "orientation", stringResource(R.string.setup_session_orientation), stringResource(R.string.setup_session_orientation_hint), SessionPrefs.orientationOptions.map { (value, label) -> value to stringResource(label) }, s.orientation, onPick = a.onOrientation, ) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/Layout.kt b/app/src/main/java/com/droiddeck/launcher/ui/Layout.kt index 9777ee83b2..594492f840 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/Layout.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/Layout.kt @@ -2,6 +2,12 @@ package com.droiddeck.launcher.ui import androidx.compose.runtime.Composable import androidx.compose.runtime.compositionLocalOf +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.layout.Layout +import androidx.compose.ui.unit.Constraints import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.unit.dp @@ -13,3 +19,38 @@ val LocalNarrowPane = compositionLocalOf { false } @Composable internal fun isNarrowScreen(): Boolean = LocalConfiguration.current.screenWidthDp < 600 +@Composable +internal fun LauncherLayout( + bottomNavigation: Boolean, divider: Color, modifier: Modifier = Modifier, + navigation: @Composable () -> Unit, content: @Composable () -> Unit, +) { + Layout(modifier = modifier, content = { + Box { content() } + Box(Modifier.background(divider)) + Box { navigation() } + }) { children, constraints -> + val width = constraints.maxWidth + val height = constraints.maxHeight + val line = 1.dp.roundToPx() + val nav = children[2].measure(Constraints( + minWidth = if (bottomNavigation) width else 0, maxWidth = width, + minHeight = if (bottomNavigation) 0 else height, maxHeight = height, + )) + val contentWidth = if (bottomNavigation) width else (width - nav.width - line).coerceAtLeast(0) + val contentHeight = if (bottomNavigation) (height - nav.height - line).coerceAtLeast(0) else height + val pane = children[0].measure(Constraints.fixed(contentWidth, contentHeight)) + val edge = children[1].measure(Constraints.fixed(if (bottomNavigation) width else line, if (bottomNavigation) line else height)) + layout(width, height) { + if (bottomNavigation) { + pane.placeRelative(0, 0) + edge.placeRelative(0, contentHeight) + nav.placeRelative(0, contentHeight + line) + } else { + nav.placeRelative(0, 0) + edge.placeRelative(nav.width, 0) + pane.placeRelative(nav.width + line, 0) + } + } + } +} + diff --git a/app/src/main/java/com/droiddeck/launcher/ui/SteamHome.kt b/app/src/main/java/com/droiddeck/launcher/ui/SteamHome.kt index dfb6d2525d..49cfd2da49 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/SteamHome.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/SteamHome.kt @@ -128,7 +128,7 @@ internal fun SteamHome(s: FrontEndState, a: FrontEndActions, modifier: Modifier) }, onOpen = a.onSteamSettings, onPrimary = a.onPlay, modifier = modifier.clipToBounds(), - start = if (narrow) 20.dp else 44.dp, bottom = if (narrow) 20.dp else 44.dp, + start = if (narrow) 20.dp else 44.dp, bottom = 44.dp, background = { when { games.isEmpty() -> EmptyLibrary( @@ -141,12 +141,20 @@ internal fun SteamHome(s: FrontEndState, a: FrontEndActions, modifier: Modifier) }, scrim = { if (games.size >= WALL_MIN_GAMES) WallFade() }, words = { - Row( + val runtimeStatus: @Composable () -> Unit = { + if (s.busy || !s.ready || (s.available != null && s.available != s.installed)) RuntimeChip(s) + } + if (narrow) Column( + verticalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier.onPlaced { words = it.boundsInParent() }, + ) { + Wordmark(30.dp) + runtimeStatus() + } else Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier.onPlaced { words = it.boundsInParent() }, ) { Wordmark(if (narrow) 30.dp else 40.dp) - if (s.busy || !s.ready || (s.available != null && s.available != s.installed)) RuntimeChip(s) + runtimeStatus() } }, button = { click -> diff --git a/app/src/main/java/com/droiddeck/launcher/ui/StoresPage.kt b/app/src/main/java/com/droiddeck/launcher/ui/StoresPage.kt index a4e8bdaf76..2d26dc708b 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/StoresPage.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/StoresPage.kt @@ -1065,36 +1065,61 @@ internal fun ModeHeader( if (query.isNotEmpty()) onQuery("") } BackHandler(enabled = searching && !clearSearchFocus) { close() } - Column(Modifier.fillMaxWidth()) { - Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = Modifier.fillMaxWidth().heightIn(min = 52.dp).padding(vertical = 4.dp)) { - if (lead != null) lead() - else Text( - title, fontSize = 15.sp, fontWeight = FontWeight.Bold, color = colors.onBackground, maxLines = 1, - modifier = Modifier.padding(start = 4.dp, end = 4.dp), - ) - BoxWithConstraints(Modifier.weight(1f), contentAlignment = Alignment.CenterStart) { - if (searching || open > 0.01f) { - val closable = maxWidth >= 80.dp - val w = androidx.compose.ui.unit.lerp(44.dp, (maxWidth - if (closable) 36.dp else 0.dp).coerceIn(44.dp, 520.dp), open) - Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(4.dp)) { - Box(Modifier.width(w).graphicsLayer { alpha = (open * 1.6f).coerceAtMost(1f) }) { - AdbTextField( - value = query, onValueChange = onQuery, label = "", keyboardType = KeyboardType.Text, imeAction = ImeAction.Search, - placeholder = placeholder, compact = true, focusOnShow = focusOnOpen, - clearFocus = clearSearchFocus || !searching, - onFocusChange = { focused -> if (!focused && query.isEmpty()) { searching = false; focusOnOpen = false } }, - ) - } - if (searching && closable) SmallIconButton(Icons.Filled.Close, stringResource(R.string.common_close), tint = colors.onSurfaceVariant, onClick = close) - } - } else SearchIcon(stringResource(R.string.stores_search_open)) { searching = true; focusOnOpen = true } + val heading: @Composable () -> Unit = { + if (lead != null) lead() + else Text( + title, fontSize = 15.sp, fontWeight = FontWeight.Bold, color = colors.onBackground, maxLines = 1, + modifier = Modifier.padding(start = 4.dp, end = 4.dp), + ) + } + val searchField: @Composable (Modifier) -> Unit = { modifier -> + BoxWithConstraints(modifier, contentAlignment = Alignment.CenterStart) { + val closable = maxWidth >= 80.dp + val w = androidx.compose.ui.unit.lerp(44.dp, (maxWidth - if (closable) 36.dp else 0.dp).coerceIn(44.dp, 520.dp), open) + Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(4.dp)) { + Box(Modifier.width(w).graphicsLayer { alpha = (open * 1.6f).coerceAtMost(1f) }) { + AdbTextField( + value = query, onValueChange = onQuery, label = "", keyboardType = KeyboardType.Text, imeAction = ImeAction.Search, + placeholder = placeholder, compact = true, focusOnShow = focusOnOpen, + clearFocus = clearSearchFocus || !searching, + onFocusChange = { focused -> if (!focused && query.isEmpty()) { searching = false; focusOnOpen = false } }, + ) + } + if (searching && closable) SmallIconButton(Icons.Filled.Close, stringResource(R.string.common_close), tint = colors.onSurfaceVariant, onClick = close) } - trailing() } - Box(Modifier.fillMaxWidth().height(1.dp).background(pal.line)) + } + val searchButton: @Composable () -> Unit = { + SearchIcon(stringResource(R.string.stores_search_open)) { searching = true; focusOnOpen = true } + } + BoxWithConstraints(Modifier.fillMaxWidth()) { + val stacked = maxWidth < NarrowPaneWidth + Column(Modifier.fillMaxWidth()) { + if (stacked) { + Box(Modifier.padding(vertical = 4.dp)) { heading() } + Row( + verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp), + modifier = Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()).heightIn(min = 52.dp).padding(vertical = 4.dp), + ) { + searchButton() + trailing() + } + if (searching || open > 0.01f) searchField(Modifier.fillMaxWidth().padding(bottom = 6.dp)) + } else Row( + verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp), + modifier = Modifier.fillMaxWidth().heightIn(min = 52.dp).padding(vertical = 4.dp), + ) { + heading() + if (searching || open > 0.01f) searchField(Modifier.weight(1f)) + else Box(Modifier.weight(1f)) { searchButton() } + trailing() + } + Box(Modifier.fillMaxWidth().height(1.dp).background(pal.line)) + } } } + internal fun storePalette(base: Palette, store: Store?): Palette { val (accent, deep) = when (store) { Store.GOG -> Color(0xFFC25BC8) to Color(0xFF9A3FA1) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d260c3da88..03204a9ffa 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -829,6 +829,11 @@ DroidDeck can be the Home app DroidDeck is never offered as a Home app Orientation + Launcher orientation + Follow device rotation + Portrait + Game and desktop orientation + Applies to Steam, games, desktop, and the controller editor. Automatic landscape Landscape Reverse landscape diff --git a/app/src/test/java/com/droiddeck/launcher/session/OrientationTest.kt b/app/src/test/java/com/droiddeck/launcher/session/OrientationTest.kt index 5d67d041a2..e694b8b3c7 100644 --- a/app/src/test/java/com/droiddeck/launcher/session/OrientationTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/session/OrientationTest.kt @@ -2,6 +2,7 @@ package com.droiddeck.launcher.session import android.content.Context import android.content.pm.ActivityInfo +import com.droiddeck.launcher.core.AppUiPrefs import org.junit.Assert.* import org.junit.Before import org.junit.Test @@ -17,6 +18,7 @@ class OrientationTest { @Before fun clearOrientation() { context.getSharedPreferences("session", Context.MODE_PRIVATE).edit().clear().commit() + context.getSharedPreferences("app-ui", Context.MODE_PRIVATE).edit().clear().commit() } @Test fun landscapeChoicesPersistGloballyAndCanRestoreAutomaticRotation() { @@ -41,4 +43,25 @@ class OrientationTest { } assertEquals(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE, SessionPrefs.orientation(context)) } + + @Test fun launcherFollowsDeviceRotationAndPortraitDoesNotChangeSessions() { + assertEquals(ActivityInfo.SCREEN_ORIENTATION_USER, AppUiPrefs.orientation(context)) + for ((value, _) in AppUiPrefs.orientationOptions) { + AppUiPrefs.setOrientation(context, value) + assertEquals(value, AppUiPrefs.orientation(context)) + assertEquals(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE, SessionPrefs.orientation(context)) + } + AppUiPrefs.setOrientation(context, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) + SessionPrefs.setOrientation(context, ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE) + assertEquals(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, AppUiPrefs.orientation(context)) + } + + @Test fun invalidLauncherOrientationFallsBackAndInvalidChoicePreservesPreference() { + context.getSharedPreferences("app-ui", Context.MODE_PRIVATE).edit().putInt("orientation", 999).commit() + assertEquals(ActivityInfo.SCREEN_ORIENTATION_USER, AppUiPrefs.orientation(context)) + AppUiPrefs.setOrientation(context, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) + assertThrows(IllegalArgumentException::class.java) { AppUiPrefs.setOrientation(context, 999) } + assertEquals(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, AppUiPrefs.orientation(context)) + } + } diff --git a/app/src/test/java/com/droiddeck/launcher/ui/PortraitLayoutTest.kt b/app/src/test/java/com/droiddeck/launcher/ui/PortraitLayoutTest.kt new file mode 100644 index 0000000000..e1210893f0 --- /dev/null +++ b/app/src/test/java/com/droiddeck/launcher/ui/PortraitLayoutTest.kt @@ -0,0 +1,137 @@ +package com.droiddeck.launcher.ui + +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.size +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton +import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.mutableIntStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.testTag +import androidx.compose.ui.test.* +import androidx.compose.ui.unit.dp +import org.junit.Assert.* +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import org.robolectric.annotation.Config + +@RunWith(RobolectricTestRunner::class) +@Config(sdk = [28], qualifiers = "w960dp-h900dp-mdpi") +class PortraitLayoutTest { + @get:Rule val compose = createRobolectricComposeRule() + + @Before fun freezeAnimations() { + compose.mainClock.autoAdvance = false + Hops.railPreview = null + } + + @Test fun navigationSitsAtBottomAndRotatingPreservesContentState() { + val portrait = mutableStateOf(true) + compose.setContent { + DroidDeckTheme { + LauncherLayout(portrait.value, Color.Gray, + Modifier.size(if (portrait.value) 480.dp else 800.dp, if (portrait.value) 800.dp else 480.dp).testTag("launcher"), + navigation = { + if (portrait.value) BottomBar(state, "steam", {}, {}, actions, Modifier) + else SideRail(state, "steam", {}, {}, actions, Modifier.fillMaxHeight()) + }, + ) { + var count by remember { mutableIntStateOf(0) } + Box(Modifier.fillMaxSize().testTag("pane")) { + TextButton(onClick = { count++ }) { Text("Count $count") } + } + } + } + } + compose.mainClock.advanceTimeBy(1_000) + val root = compose.onNodeWithTag("launcher").getUnclippedBoundsInRoot() + val pane = compose.onNodeWithTag("pane").getUnclippedBoundsInRoot() + val steam = compose.onNodeWithTag("rail-steam").getUnclippedBoundsInRoot() + assertEquals(root.left, pane.left) + assertEquals(root.right, pane.right) + assertTrue(steam.top >= pane.bottom) + assertEquals(root.bottom - 4.dp, steam.bottom) + compose.onNodeWithText("Count 0").performClick() + compose.runOnIdle { portrait.value = false } + compose.mainClock.advanceTimeBy(1_000) + compose.onNodeWithText("Count 1").assertExists() + val landscapePane = compose.onNodeWithTag("pane").getUnclippedBoundsInRoot() + val rail = compose.onNodeWithTag("rail-steam").getUnclippedBoundsInRoot() + assertTrue(landscapePane.left > rail.right) + assertEquals(0.dp, landscapePane.top) + compose.runOnIdle { portrait.value = true } + compose.mainClock.advanceTimeBy(1_000) + compose.onNodeWithText("Count 1").assertExists() + } + + @Test fun narrowBottomBarScrollsToEveryDestinationWithAppsAndResumeVisible() { + val selected = mutableStateOf("steam") + compose.setContent { + DroidDeckTheme { + BottomBar(stateWithAppsAndSession, selected.value, { selected.value = it }, {}, actions, Modifier.size(320.dp, 64.dp)) + } + } + compose.mainClock.advanceTimeBy(1_000) + for (key in listOf("games", "stores", "desktop", "components", "android-apps", "setup", "updates", "steam")) { + compose.onNodeWithTag("rail-$key").performScrollTo() + compose.mainClock.advanceTimeBy(1_000) + compose.onNodeWithTag("rail-$key").assertIsDisplayed().performClick() + compose.mainClock.advanceTimeBy(1_000) + compose.runOnIdle { assertEquals(key, selected.value); assertNull(Hops.railPreview) } + compose.onNodeWithTag("rail-$key").assertIsSelected().assertHeightIsAtLeast(48.dp).assertWidthIsAtLeast(48.dp) + } + compose.onNodeWithContentDescription("Resume Steam").assertIsDisplayed() + } + + @Test fun compactHeaderKeepsAllActionsReachable() { + compose.setContent { + DroidDeckTheme { + CompositionLocalProvider(LocalNarrowPane provides true) { + Box(Modifier.size(320.dp, 240.dp)) { + ModeHeader("Library", "", {}, "Search library") { + for (label in listOf("Filter", "Sort", "View", "Frontend files", "Add game")) { + SecondaryButton(label) {} + } + } + } + } + } + } + compose.mainClock.advanceTimeBy(1_000) + compose.onNodeWithText("Add game").performScrollTo() + compose.mainClock.advanceTimeBy(1_000) + compose.onNodeWithText("Add game").assertIsDisplayed() + compose.onNodeWithText("Filter").performScrollTo() + compose.mainClock.advanceTimeBy(1_000) + compose.onNodeWithText("Filter").assertIsDisplayed() + } + + private fun state(home: Boolean = false, running: String? = null) = FrontEndState( + installed = "r9", ready = true, available = null, busy = false, stage = "", percent = -1, + desktopInstalled = true, offlineAccount = null, offline = false, frameGenLabel = "", + romsDir = null, logsEnabled = false, steamGames = emptyList(), emulators = emptyList(), running = running, + isHomeApp = home, + ) + private val state get() = state() + private val stateWithAppsAndSession get() = state(home = true, running = "Steam") + + private val actions = FrontEndActions( + onPlay = {}, onPlayDesktopUi = {}, onSteamGame = {}, onDesktop = {}, onEmulator = {}, + onRom = {}, onResume = {}, onSteamSettings = {}, onDesktopSettings = {}, + onInstallPackage = {}, onRemovePackage = {}, onRuntime = {}, onFrameGenPick = {}, + onImportLossless = {}, onProtons = {}, onComponents = {}, onPerformance = {}, + onRoms = {}, onFiles = {}, onLogs = {}, onOffline = {}, + onWirelessAdbPair = { _, _, _, _ -> }, onWirelessAdbApply = { _, _, _, _ -> }, + onSetPhantomProcessLimit = { _, _ -> }, + ) +}