summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt30
-rw-r--r--src/android/app/src/main/res/menu/menu_overlay_options.xml5
-rw-r--r--src/android/app/src/main/res/values/strings.xml1
3 files changed, 30 insertions, 6 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
index 8e94fd1db..daa704565 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
@@ -3,6 +3,7 @@
package org.yuzu.yuzu_emu.fragments
+import android.app.AlertDialog
import android.content.Context
import android.content.SharedPreferences
import android.graphics.Color
@@ -222,8 +223,10 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
popup.menuInflater.inflate(R.menu.menu_overlay_options, popup.menu)
- popup.menu.findItem(R.id.menu_rel_stick_center).isChecked = EmulationMenuSettings.joystickRelCenter
+ popup.menu.findItem(R.id.menu_rel_stick_center).isChecked =
+ EmulationMenuSettings.joystickRelCenter
popup.menu.findItem(R.id.menu_dpad_slide).isChecked = EmulationMenuSettings.dpadSlide
+ popup.menu.findItem(R.id.menu_show_overlay).isChecked = EmulationMenuSettings.showOverlay
popup.setOnMenuItemClickListener {
when (it.itemId) {
@@ -241,7 +244,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
optionsArray[i] = preferences.getBoolean("buttonToggle$i", i < 13)
}
- MaterialAlertDialogBuilder(requireContext())
+ val dialog = MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.emulation_toggle_controls)
.setMultiChoiceItems(
R.array.gamepadButtons,
@@ -254,12 +257,27 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
.setPositiveButton(android.R.string.ok) { _, _ ->
refreshInputOverlay()
}
- .setNeutralButton(R.string.emulation_toggle_all) { _, _ ->
- EmulationMenuSettings.showOverlay = !EmulationMenuSettings.showOverlay
- refreshInputOverlay()
- }
+ .setNeutralButton(R.string.emulation_toggle_all) { _, _ -> }
.show()
+ // Override normal behaviour so the dialog doesn't close
+ dialog.getButton(AlertDialog.BUTTON_NEUTRAL)
+ .setOnClickListener {
+ val isChecked = !optionsArray[0];
+ for (i in 0..14) {
+ optionsArray[i] = isChecked;
+ dialog.listView.setItemChecked(i, isChecked)
+ preferences.edit()
+ .putBoolean("buttonToggle$i", isChecked)
+ .apply()
+ }
+ }
+ true
+ }
+ R.id.menu_show_overlay -> {
+ it.isChecked = !it.isChecked
+ EmulationMenuSettings.showOverlay = it.isChecked
+ refreshInputOverlay()
true
}
R.id.menu_rel_stick_center -> {
diff --git a/src/android/app/src/main/res/menu/menu_overlay_options.xml b/src/android/app/src/main/res/menu/menu_overlay_options.xml
index 36c710f14..17ba5496d 100644
--- a/src/android/app/src/main/res/menu/menu_overlay_options.xml
+++ b/src/android/app/src/main/res/menu/menu_overlay_options.xml
@@ -10,6 +10,11 @@
android:title="@string/emulation_toggle_controls" />
<item
+ android:id="@+id/menu_show_overlay"
+ android:title="@string/emulation_show_overlay"
+ android:checkable="true" />
+
+ <item
android:id="@+id/menu_rel_stick_center"
android:title="@string/emulation_rel_stick_center"
android:checkable="true" />
diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml
index 58ae37790..c55b9e06b 100644
--- a/src/android/app/src/main/res/values/strings.xml
+++ b/src/android/app/src/main/res/values/strings.xml
@@ -139,6 +139,7 @@
<string name="emulation_toggle_controls">Toggle Controls</string>
<string name="emulation_rel_stick_center">Relative Stick Center</string>
<string name="emulation_dpad_slide">DPad Slide</string>
+ <string name="emulation_show_overlay">Show Overlay</string>
<string name="emulation_toggle_all">Toggle All</string>
<string name="emulation_control_scale">Adjust Scale</string>
<string name="emulation_touch_overlay_reset">Reset Overlay</string>