mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 21:35:59 +00:00
Add game file exports and sync for Android frontends (#179)
This commit is contained in:
1 parent
e168f7e942
commit
abbbc4a88a
13 files changed
+502
-20
No files matched your search
@@ -73,6 +73,7 @@ internal fun GamesPage(s: FrontEndState, a: FrontEndActions, selected: String, o
|
||||
if (!s.shortcutPicker) Rise(2) {
|
||||
Actions { PrimaryButton(stringResource(R.string.games_play_steam), enabled = !s.busy, main = true, icon = Icons.Filled.PlayArrow, modifier = Modifier.padding(top = 12.dp), onClick = a.onPlay) }
|
||||
}
|
||||
GameFileFolderActions(s, a)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -90,6 +91,7 @@ internal fun GamesPage(s: FrontEndState, a: FrontEndActions, selected: String, o
|
||||
}
|
||||
Rise(1) { SectionTitle(stringResource(R.string.games_launch_settings), null) }
|
||||
Rise(2) { LaunchSettings(s, a, host) }
|
||||
Rise(3) { GameFileFolderActions(s, a) }
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -108,6 +110,24 @@ internal fun GamesPage(s: FrontEndState, a: FrontEndActions, selected: String, o
|
||||
}
|
||||
SectionTitle(stringResource(R.string.games_launch_settings), null)
|
||||
LaunchSettings(s, a, host)
|
||||
GameFileFolderActions(s, a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun GameFileFolderActions(s: FrontEndState, a: FrontEndActions) {
|
||||
if (s.shortcutPicker) return
|
||||
var open by remember { androidx.compose.runtime.mutableStateOf(false) }
|
||||
Box(Modifier.padding(top = 12.dp)) {
|
||||
SecondaryButton(stringResource(R.string.game_frontend_files), compact = true) { open = !open }
|
||||
AnchoredMenu(open, onDismiss = { open = false }, title = s.gameSyncFolder ?: stringResource(R.string.game_frontend_files)) { first ->
|
||||
MenuItem(stringResource(R.string.game_file_sync), checked = false, focusRequester = first) {
|
||||
open = false; a.onSyncGameFiles()
|
||||
}
|
||||
if (s.gameSyncFolder != null) MenuItem(stringResource(R.string.game_file_stop_sync), checked = false) {
|
||||
open = false; a.onStopGameFileSync()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,6 +159,9 @@ private fun GameShortcutMenu(g: Library.SteamGame, a: FrontEndActions) {
|
||||
MenuItem(stringResource(R.string.game_shortcut_add), checked = false, focusRequester = first) {
|
||||
open = false; a.onGameShortcut(g)
|
||||
}
|
||||
MenuItem(stringResource(R.string.game_file_export), checked = false) {
|
||||
open = false; a.onExportGameFile(g)
|
||||
}
|
||||
MenuItem(stringResource(R.string.game_link_copy), checked = false) {
|
||||
open = false; a.onCopyGameLink(g)
|
||||
}
|
||||
|
||||
@@ -98,6 +98,7 @@ class FrontEndState(
|
||||
val lossless: Lossless.State = Lossless.State.NONE,
|
||||
val shortcutPicker: Boolean = false,
|
||||
val shortcutLibraryScanning: Boolean = false,
|
||||
val gameSyncFolder: String? = null,
|
||||
val pageKey: String? = null,
|
||||
val theme: String = Themes.GRAPHITE,
|
||||
val isHomeApp: Boolean = false,
|
||||
@@ -129,6 +130,9 @@ class FrontEndActions(
|
||||
val onPlayDesktopUi: () -> Unit,
|
||||
val onSteamGame: (Library.SteamGame) -> Unit,
|
||||
val onGameShortcut: (Library.SteamGame) -> Unit = {},
|
||||
val onExportGameFile: (Library.SteamGame) -> Unit = {},
|
||||
val onSyncGameFiles: () -> Unit = {},
|
||||
val onStopGameFileSync: () -> Unit = {},
|
||||
val onCopyGameLink: (Library.SteamGame) -> Unit = {},
|
||||
val onDesktop: () -> Unit,
|
||||
val onEmulator: (Library.Emulator) -> Unit,
|
||||
|
||||
Reference in new issue
Block a user