diff --git a/app/src/main/java/com/droiddeck/launcher/ui/DrawerControls.kt b/app/src/main/java/com/droiddeck/launcher/ui/DrawerControls.kt index c593fb3b2e..a96ad45e60 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/DrawerControls.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/DrawerControls.kt @@ -48,8 +48,9 @@ internal fun DrawerControlsGroup(host: MenuHost, a: DrawerActions, track: (Strin .onFailure { failure = it.message ?: context.getString(R.string.input_save_failed) } } val gameKey = game?.first - val active = library.profile(library.activeId(a.desktop, gameKey)) - val changes = gameKey?.let { library.gameChanges(a.desktop, it) } ?: 0 + val scopeKey = gameKey.takeIf { gameScope } + val active = library.profile(library.activeId(a.desktop, scopeKey)) + val changes = scopeKey?.let { library.gameChanges(a.desktop, it) } ?: 0 val own = gameKey?.let { library.games[it] } val named = library.profiles.map { it.id to profileLabel(context, it) } // For one game the first choice follows whatever all games use; for all games the profile itself is the choice. @@ -69,12 +70,12 @@ internal fun DrawerControlsGroup(host: MenuHost, a: DrawerActions, track: (Strin } val physical = if (gameScope && gameKey != null && own?.parts?.containsKey(InputRole.PHYSICAL) == true) stringResource(R.string.flow_game_changes, game.second, library.gameChanges(a.desktop, gameKey, InputRole.PHYSICAL)) - else profileLabel(context, if (gameScope) active else library.profile(library.activeId(a.desktop))) + else profileLabel(context, active) ActionRow(stringResource(R.string.flow_buttons), physical, stringResource(R.string.ctrl_edit), a.onEditButtons, modifier = track("input-buttons").testTag("input-edit-buttons")) a.onEditLayout?.let { edit -> val layoutName = if (a.oscMode == SessionPrefs.OSC_STEAM_TOUCH && a.steam) stringResource(R.string.osc_steam_layout) - else library.activeLayout(a.desktop, InputRole.PRIMARY, gameKey.takeIf { gameScope })?.name + else library.activeLayout(a.desktop, InputRole.PRIMARY, scopeKey)?.name ActionRow(stringResource(R.string.flow_layout), layoutName, stringResource(R.string.ctrl_edit), edit, modifier = track("input-layout").testTag("input-edit-layout")) }