android: Add dedicated show overlay checkbox
This commit is contained in:
parent
912bf6a0c6
commit
d1fb7ea58b
|
@ -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 -> {
|
||||
|
|
|
@ -9,6 +9,11 @@
|
|||
android:id="@+id/menu_toggle_controls"
|
||||
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"
|
||||
|
|
|
@ -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>
|
||||
|
|
Reference in New Issue