[GameProperties] Add support for secondary actions
This commit is contained in:
parent
28d26b0d76
commit
2eed537da1
4 changed files with 34 additions and 1 deletions
|
@ -83,6 +83,17 @@ class GamePropertiesAdapter(
|
||||||
} else {
|
} else {
|
||||||
binding.details.setVisible(false)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,17 @@ data class SubmenuProperty(
|
||||||
override val iconId: Int,
|
override val iconId: Int,
|
||||||
val details: (() -> String)? = null,
|
val details: (() -> String)? = null,
|
||||||
val detailsFlow: StateFlow<String>? = null,
|
val detailsFlow: StateFlow<String>? = null,
|
||||||
val action: () -> Unit
|
val action: () -> Unit,
|
||||||
|
val secondaryAction: SubMenuProperSecondaryAction? = null
|
||||||
) : GameProperty
|
) : GameProperty
|
||||||
|
|
||||||
|
data class SubMenuProperSecondaryAction(
|
||||||
|
val isShown : Boolean,
|
||||||
|
val descriptionId: Int,
|
||||||
|
val iconId: Int,
|
||||||
|
val action: () -> Unit
|
||||||
|
)
|
||||||
|
|
||||||
data class InstallableProperty(
|
data class InstallableProperty(
|
||||||
override val titleId: Int,
|
override val titleId: Int,
|
||||||
override val descriptionId: Int,
|
override val descriptionId: Int,
|
||||||
|
|
|
@ -67,6 +67,17 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/buttonSecondaryAction"
|
||||||
|
style="@style/Widget.Material3.Button.IconButton"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:iconSize="20dp"
|
||||||
|
tools:visibility="visible"
|
||||||
|
tools:icon="@drawable/ic_info_outline" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
|
@ -752,6 +752,9 @@
|
||||||
<string name="updates_and_dlc">Updates and DLC</string>
|
<string name="updates_and_dlc">Updates and DLC</string>
|
||||||
<string name="mods_and_cheats">Mods and cheats</string>
|
<string name="mods_and_cheats">Mods and cheats</string>
|
||||||
<string name="addon_notice">Important addon notice</string>
|
<string name="addon_notice">Important addon notice</string>
|
||||||
|
<string name="share_game_settings">Share Game Settings</string>
|
||||||
|
<string name="share_config_failed">Failed to share configuration file</string>
|
||||||
|
|
||||||
<!-- "cheats/" "romfs/" and "exefs/ should not be translated -->
|
<!-- "cheats/" "romfs/" and "exefs/ should not be translated -->
|
||||||
<string name="addon_notice_description">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!</string>
|
<string name="addon_notice_description">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!</string>
|
||||||
<string name="invalid_directory">Invalid directory</string>
|
<string name="invalid_directory">Invalid directory</string>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue