From 2eed537da1a1da33c301009393b7a241fbbd6775 Mon Sep 17 00:00:00 2001 From: nyx Date: Sat, 13 Sep 2025 09:39:18 +0200 Subject: [PATCH] [GameProperties] Add support for secondary actions --- .../yuzu/yuzu_emu/adapters/GamePropertiesAdapter.kt | 11 +++++++++++ .../java/org/yuzu/yuzu_emu/model/GameProperties.kt | 10 +++++++++- .../app/src/main/res/layout/card_simple_outlined.xml | 11 +++++++++++ src/android/app/src/main/res/values/strings.xml | 3 +++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GamePropertiesAdapter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GamePropertiesAdapter.kt index 7366e2c778..73a96bf17c 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GamePropertiesAdapter.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GamePropertiesAdapter.kt @@ -83,6 +83,17 @@ class GamePropertiesAdapter( } else { binding.details.setVisible(false) } + + if (submenuProperty.secondaryAction != null) { + binding.buttonSecondaryAction.setVisible(submenuProperty.secondaryAction.isShown) + binding.buttonSecondaryAction.setIconResource(submenuProperty.secondaryAction.iconId) + binding.buttonSecondaryAction.contentDescription = binding.buttonSecondaryAction.context.getString(submenuProperty.secondaryAction.descriptionId) + binding.buttonSecondaryAction.setOnClickListener { + submenuProperty.secondaryAction.action.invoke() + } + } else { + binding.buttonSecondaryAction.setVisible(false) + } } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GameProperties.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GameProperties.kt index 0135a95beb..0b3c1f59f8 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GameProperties.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GameProperties.kt @@ -24,9 +24,17 @@ data class SubmenuProperty( override val iconId: Int, val details: (() -> String)? = null, val detailsFlow: StateFlow? = null, - val action: () -> Unit + val action: () -> Unit, + val secondaryAction: SubMenuProperSecondaryAction? = null ) : GameProperty +data class SubMenuProperSecondaryAction( + val isShown : Boolean, + val descriptionId: Int, + val iconId: Int, + val action: () -> Unit +) + data class InstallableProperty( override val titleId: Int, override val descriptionId: Int, diff --git a/src/android/app/src/main/res/layout/card_simple_outlined.xml b/src/android/app/src/main/res/layout/card_simple_outlined.xml index e29df6a2de..4f64b3fdd9 100644 --- a/src/android/app/src/main/res/layout/card_simple_outlined.xml +++ b/src/android/app/src/main/res/layout/card_simple_outlined.xml @@ -67,6 +67,17 @@ + + diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index 2c7923d5a3..98a1ca6415 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -752,6 +752,9 @@ Updates and DLC Mods and cheats Important addon notice + Share Game Settings + Failed to share configuration file + In order to install mods and cheats, you must select a folder that contains a cheats/, romfs/, or exefs/ directory. We can\'t verify if these will be compatible with your game so be careful! Invalid directory