mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-28 01:49:33 -06:00
Android: Don't dismiss AdvancedMappingDialog when pressing Clear
If you already have a mapping set in the advanced mapping dialog and want to change it, the easiest way to do it is to press Clear and then select the new mapping from the list. But pressing Clear causes the dialog to close, forcing you to open it again, which is inconvenient. This commit makes it so the Clear button doesn't close the dialog.
This commit is contained in:
@ -52,8 +52,9 @@ class AdvancedMappingDialog(
|
|||||||
selectDefaultDevice()
|
selectDefaultDevice()
|
||||||
}
|
}
|
||||||
|
|
||||||
val expression: String
|
var expression: String
|
||||||
get() = binding.editExpression.text.toString()
|
get() = binding.editExpression.text.toString()
|
||||||
|
set(value) = binding.editExpression.setText(value)
|
||||||
|
|
||||||
override fun onItemClick(adapterView: AdapterView<*>?, view: View, position: Int, id: Long) =
|
override fun onItemClick(adapterView: AdapterView<*>?, view: View, position: Int, id: Long) =
|
||||||
setSelectedDevice(devices[position])
|
setSelectedDevice(devices[position])
|
||||||
|
@ -347,13 +347,15 @@ class SettingsAdapter(
|
|||||||
dialog.setButton(
|
dialog.setButton(
|
||||||
AlertDialog.BUTTON_NEUTRAL,
|
AlertDialog.BUTTON_NEUTRAL,
|
||||||
context.getString(R.string.clear)
|
context.getString(R.string.clear)
|
||||||
) { _: DialogInterface?, _: Int ->
|
) { _: DialogInterface?, _: Int -> }
|
||||||
item.clearValue()
|
|
||||||
notifyItemChanged(position)
|
|
||||||
fragmentView.onSettingChanged()
|
|
||||||
}
|
|
||||||
dialog.setCanceledOnTouchOutside(false)
|
dialog.setCanceledOnTouchOutside(false)
|
||||||
dialog.show()
|
dialog.show()
|
||||||
|
|
||||||
|
// We're setting this OnClickListener late so that pressing the Clear button won't result
|
||||||
|
// in the dialog closing
|
||||||
|
dialog.getButton(AlertDialog.BUTTON_NEUTRAL).setOnClickListener {
|
||||||
|
dialog.expression = ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onFilePickerDirectoryClick(item: SettingsItem, position: Int) {
|
fun onFilePickerDirectoryClick(item: SettingsItem, position: Int) {
|
||||||
|
Reference in New Issue
Block a user