From 87df7a2c2155d0e525bebb94ba04752a4f2fbe8c 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 | 2 ++ 4 files changed, 33 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 00206a5df5..6adf768373 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -791,6 +791,8 @@ Integrity verification couldn\'t be performed File contents were not checked for validity Verification failed for the following files:\n%1$s + Share Game Settings + Failed to share configuration file Your ROM is encrypted