mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-16 04:09:39 +00:00
Android: Treat EmulationActivity dialog dismiss the same as OK
In the dialog where you can choose what controller the input overlay should be controlling, there's an OK button. If you change controller but don't press OK, your selection will be saved, but the input overlay won't refresh to show the new controller unless you perform some other action that would cause it to refresh. This is not good UX. This commit changes the behavior not only of this dialog but also other dialogs spawned by EmulationActivity so that everything is properly updated when dismissing a dialog, as if you had pressed OK.
This commit is contained in:
parent
b74c3faa48
commit
a026a0d5e4
@ -561,6 +561,7 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
|||||||
) { _: DialogInterface?, indexSelected: Int, isChecked: Boolean ->
|
) { _: DialogInterface?, indexSelected: Int, isChecked: Boolean ->
|
||||||
BooleanSetting.valueOf(gcSettingBase + indexSelected)
|
BooleanSetting.valueOf(gcSettingBase + indexSelected)
|
||||||
.setBoolean(settings, isChecked)
|
.setBoolean(settings, isChecked)
|
||||||
|
emulationFragment?.refreshInputOverlay()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
InputOverlay.OVERLAY_WIIMOTE_CLASSIC -> {
|
InputOverlay.OVERLAY_WIIMOTE_CLASSIC -> {
|
||||||
@ -575,6 +576,7 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
|||||||
) { _: DialogInterface?, indexSelected: Int, isChecked: Boolean ->
|
) { _: DialogInterface?, indexSelected: Int, isChecked: Boolean ->
|
||||||
BooleanSetting.valueOf(classicSettingBase + indexSelected)
|
BooleanSetting.valueOf(classicSettingBase + indexSelected)
|
||||||
.setBoolean(settings, isChecked)
|
.setBoolean(settings, isChecked)
|
||||||
|
emulationFragment?.refreshInputOverlay()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
InputOverlay.OVERLAY_WIIMOTE_NUNCHUK -> {
|
InputOverlay.OVERLAY_WIIMOTE_NUNCHUK -> {
|
||||||
@ -596,6 +598,7 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
|||||||
) { _: DialogInterface?, indexSelected: Int, isChecked: Boolean ->
|
) { _: DialogInterface?, indexSelected: Int, isChecked: Boolean ->
|
||||||
BooleanSetting.valueOf(nunchukSettingBase + translateToSettingsIndex(indexSelected))
|
BooleanSetting.valueOf(nunchukSettingBase + translateToSettingsIndex(indexSelected))
|
||||||
.setBoolean(settings, isChecked)
|
.setBoolean(settings, isChecked)
|
||||||
|
emulationFragment?.refreshInputOverlay()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
@ -611,14 +614,13 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
|||||||
) { _: DialogInterface?, indexSelected: Int, isChecked: Boolean ->
|
) { _: DialogInterface?, indexSelected: Int, isChecked: Boolean ->
|
||||||
BooleanSetting.valueOf(wiimoteSettingBase + indexSelected)
|
BooleanSetting.valueOf(wiimoteSettingBase + indexSelected)
|
||||||
.setBoolean(settings, isChecked)
|
.setBoolean(settings, isChecked)
|
||||||
|
emulationFragment?.refreshInputOverlay()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
builder
|
builder
|
||||||
.setPositiveButton(R.string.ok) { _: DialogInterface?, _: Int ->
|
.setPositiveButton(R.string.ok, null)
|
||||||
emulationFragment?.refreshInputOverlay()
|
|
||||||
}
|
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -640,6 +642,7 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
|||||||
) { _: DialogInterface?, indexSelected: Int, isChecked: Boolean ->
|
) { _: DialogInterface?, indexSelected: Int, isChecked: Boolean ->
|
||||||
BooleanSetting
|
BooleanSetting
|
||||||
.valueOf(gcSettingBase + indexSelected).setBoolean(settings, isChecked)
|
.valueOf(gcSettingBase + indexSelected).setBoolean(settings, isChecked)
|
||||||
|
emulationFragment?.refreshInputOverlay()
|
||||||
}
|
}
|
||||||
} else if (currentController == InputOverlay.OVERLAY_WIIMOTE_CLASSIC) {
|
} else if (currentController == InputOverlay.OVERLAY_WIIMOTE_CLASSIC) {
|
||||||
val wiiClassicEnabledButtons = BooleanArray(14)
|
val wiiClassicEnabledButtons = BooleanArray(14)
|
||||||
@ -653,6 +656,7 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
|||||||
) { _: DialogInterface?, indexSelected: Int, isChecked: Boolean ->
|
) { _: DialogInterface?, indexSelected: Int, isChecked: Boolean ->
|
||||||
BooleanSetting.valueOf(classicSettingBase + indexSelected)
|
BooleanSetting.valueOf(classicSettingBase + indexSelected)
|
||||||
.setBoolean(settings, isChecked)
|
.setBoolean(settings, isChecked)
|
||||||
|
emulationFragment?.refreshInputOverlay()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val wiiEnabledButtons = BooleanArray(11)
|
val wiiEnabledButtons = BooleanArray(11)
|
||||||
@ -667,6 +671,7 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
|||||||
) { _: DialogInterface?, indexSelected: Int, isChecked: Boolean ->
|
) { _: DialogInterface?, indexSelected: Int, isChecked: Boolean ->
|
||||||
BooleanSetting
|
BooleanSetting
|
||||||
.valueOf(wiiSettingBase + indexSelected).setBoolean(settings, isChecked)
|
.valueOf(wiiSettingBase + indexSelected).setBoolean(settings, isChecked)
|
||||||
|
emulationFragment?.refreshInputOverlay()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
builder.setMultiChoiceItems(
|
builder.setMultiChoiceItems(
|
||||||
@ -674,6 +679,7 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
|||||||
) { _: DialogInterface?, indexSelected: Int, isChecked: Boolean ->
|
) { _: DialogInterface?, indexSelected: Int, isChecked: Boolean ->
|
||||||
BooleanSetting
|
BooleanSetting
|
||||||
.valueOf(wiiSettingBase + indexSelected).setBoolean(settings, isChecked)
|
.valueOf(wiiSettingBase + indexSelected).setBoolean(settings, isChecked)
|
||||||
|
emulationFragment?.refreshInputOverlay()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -682,7 +688,7 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
|||||||
.setNeutralButton(R.string.emulation_toggle_all) { _: DialogInterface?, _: Int ->
|
.setNeutralButton(R.string.emulation_toggle_all) { _: DialogInterface?, _: Int ->
|
||||||
emulationFragment!!.toggleInputOverlayVisibility(settings)
|
emulationFragment!!.toggleInputOverlayVisibility(settings)
|
||||||
}
|
}
|
||||||
.setPositiveButton(R.string.ok) { _: DialogInterface?, _: Int -> emulationFragment?.refreshInputOverlay() }
|
.setPositiveButton(R.string.ok, null)
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -707,10 +713,9 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
|||||||
settings,
|
settings,
|
||||||
InputOverlayPointer.DOUBLE_TAP_OPTIONS[which]
|
InputOverlayPointer.DOUBLE_TAP_OPTIONS[which]
|
||||||
)
|
)
|
||||||
}
|
|
||||||
.setPositiveButton(R.string.ok) { _: DialogInterface?, _: Int ->
|
|
||||||
emulationFragment?.initInputPointer()
|
emulationFragment?.initInputPointer()
|
||||||
}
|
}
|
||||||
|
.setPositiveButton(R.string.ok, null)
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -721,9 +726,11 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
|||||||
valueTo = 150f
|
valueTo = 150f
|
||||||
value = IntSetting.MAIN_CONTROL_SCALE.int.toFloat()
|
value = IntSetting.MAIN_CONTROL_SCALE.int.toFloat()
|
||||||
stepSize = 1f
|
stepSize = 1f
|
||||||
addOnChangeListener(Slider.OnChangeListener { _: Slider?, progress: Float, _: Boolean ->
|
addOnChangeListener { _: Slider?, value: Float, _: Boolean ->
|
||||||
dialogBinding.inputScaleValue.text = "${(progress.toInt() + 50)}%"
|
dialogBinding.inputScaleValue.text = "${(value.toInt() + 50)}%"
|
||||||
})
|
IntSetting.MAIN_CONTROL_SCALE.setInt(settings, value.toInt())
|
||||||
|
emulationFragment?.refreshInputOverlay()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
inputScaleValue.text =
|
inputScaleValue.text =
|
||||||
"${(dialogBinding.inputScaleSlider.value.toInt() + 50)}%"
|
"${(dialogBinding.inputScaleSlider.value.toInt() + 50)}%"
|
||||||
@ -732,9 +739,11 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
|||||||
valueTo = 100f
|
valueTo = 100f
|
||||||
value = IntSetting.MAIN_CONTROL_OPACITY.int.toFloat()
|
value = IntSetting.MAIN_CONTROL_OPACITY.int.toFloat()
|
||||||
stepSize = 1f
|
stepSize = 1f
|
||||||
addOnChangeListener(Slider.OnChangeListener { _: Slider?, progress: Float, _: Boolean ->
|
addOnChangeListener { _: Slider?, value: Float, _: Boolean ->
|
||||||
inputOpacityValue.text = progress.toInt().toString() + "%"
|
inputOpacityValue.text = value.toInt().toString() + "%"
|
||||||
})
|
IntSetting.MAIN_CONTROL_OPACITY.setInt(settings, value.toInt())
|
||||||
|
emulationFragment?.refreshInputOverlay()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
inputOpacityValue.text = inputOpacitySlider.value.toInt().toString() + "%"
|
inputOpacityValue.text = inputOpacitySlider.value.toInt().toString() + "%"
|
||||||
}
|
}
|
||||||
@ -742,17 +751,7 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
|||||||
MaterialAlertDialogBuilder(this)
|
MaterialAlertDialogBuilder(this)
|
||||||
.setTitle(R.string.emulation_control_adjustments)
|
.setTitle(R.string.emulation_control_adjustments)
|
||||||
.setView(dialogBinding.root)
|
.setView(dialogBinding.root)
|
||||||
.setPositiveButton(R.string.ok) { _: DialogInterface?, _: Int ->
|
.setPositiveButton(R.string.ok, null)
|
||||||
IntSetting.MAIN_CONTROL_SCALE.setInt(
|
|
||||||
settings,
|
|
||||||
dialogBinding.inputScaleSlider.value.toInt()
|
|
||||||
)
|
|
||||||
IntSetting.MAIN_CONTROL_OPACITY.setInt(
|
|
||||||
settings,
|
|
||||||
dialogBinding.inputOpacitySlider.value.toInt()
|
|
||||||
)
|
|
||||||
emulationFragment?.refreshInputOverlay()
|
|
||||||
}
|
|
||||||
.setNeutralButton(R.string.default_values) { _: DialogInterface?, _: Int ->
|
.setNeutralButton(R.string.default_values) { _: DialogInterface?, _: Int ->
|
||||||
IntSetting.MAIN_CONTROL_SCALE.delete(settings)
|
IntSetting.MAIN_CONTROL_SCALE.delete(settings)
|
||||||
IntSetting.MAIN_CONTROL_OPACITY.delete(settings)
|
IntSetting.MAIN_CONTROL_OPACITY.delete(settings)
|
||||||
@ -858,10 +857,9 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
|||||||
entries.toArray(arrayOf<CharSequence>()), checkedItem
|
entries.toArray(arrayOf<CharSequence>()), checkedItem
|
||||||
) { _: DialogInterface?, indexSelected: Int ->
|
) { _: DialogInterface?, indexSelected: Int ->
|
||||||
controllerSetting.setInt(settings, values[indexSelected])
|
controllerSetting.setInt(settings, values[indexSelected])
|
||||||
}
|
|
||||||
.setPositiveButton(R.string.ok) { _: DialogInterface?, _: Int ->
|
|
||||||
emulationFragment?.refreshInputOverlay()
|
emulationFragment?.refreshInputOverlay()
|
||||||
}
|
}
|
||||||
|
.setPositiveButton(R.string.ok, null)
|
||||||
.setNeutralButton(
|
.setNeutralButton(
|
||||||
R.string.emulation_more_controller_settings
|
R.string.emulation_more_controller_settings
|
||||||
) { _: DialogInterface?, _: Int -> SettingsActivity.launch(this, MenuTag.SETTINGS) }
|
) { _: DialogInterface?, _: Int -> SettingsActivity.launch(this, MenuTag.SETTINGS) }
|
||||||
@ -876,10 +874,9 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
|||||||
IntSetting.MAIN_IR_MODE.int
|
IntSetting.MAIN_IR_MODE.int
|
||||||
) { _: DialogInterface?, indexSelected: Int ->
|
) { _: DialogInterface?, indexSelected: Int ->
|
||||||
IntSetting.MAIN_IR_MODE.setInt(settings, indexSelected)
|
IntSetting.MAIN_IR_MODE.setInt(settings, indexSelected)
|
||||||
}
|
|
||||||
.setPositiveButton(R.string.ok) { _: DialogInterface?, _: Int ->
|
|
||||||
emulationFragment?.refreshOverlayPointer()
|
emulationFragment?.refreshOverlayPointer()
|
||||||
}
|
}
|
||||||
|
.setPositiveButton(R.string.ok, null)
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user