mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2025-12-16 12:08:49 +00:00
make it so clearing to default ACTUALLY clears gamepad settings
This commit is contained in:
parent
f1a59b2186
commit
356aa3d3ae
@ -16,6 +16,7 @@ import org.citra.citra_emu.NativeLibrary
|
|||||||
import org.citra.citra_emu.R
|
import org.citra.citra_emu.R
|
||||||
import org.citra.citra_emu.features.hotkeys.Hotkey
|
import org.citra.citra_emu.features.hotkeys.Hotkey
|
||||||
import org.citra.citra_emu.features.settings.model.AbstractSetting
|
import org.citra.citra_emu.features.settings.model.AbstractSetting
|
||||||
|
import org.citra.citra_emu.features.settings.model.AbstractStringSetting
|
||||||
import org.citra.citra_emu.features.settings.model.Settings
|
import org.citra.citra_emu.features.settings.model.Settings
|
||||||
|
|
||||||
class InputBindingSetting(
|
class InputBindingSetting(
|
||||||
@ -161,6 +162,7 @@ class InputBindingSetting(
|
|||||||
fun removeOldMapping() {
|
fun removeOldMapping() {
|
||||||
// Try remove all possible keys we wrote for this setting
|
// Try remove all possible keys we wrote for this setting
|
||||||
val oldKey = preferences.getString(reverseKey, "")
|
val oldKey = preferences.getString(reverseKey, "")
|
||||||
|
(setting as AbstractStringSetting).string = ""
|
||||||
if (oldKey != "") {
|
if (oldKey != "") {
|
||||||
preferences.edit()
|
preferences.edit()
|
||||||
.remove(abstractSetting.key) // Used for ui text
|
.remove(abstractSetting.key) // Used for ui text
|
||||||
|
|||||||
@ -555,6 +555,21 @@ class SettingsAdapter(
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun onInputBindingLongClick(setting: InputBindingSetting, position: Int): Boolean {
|
||||||
|
MaterialAlertDialogBuilder(context)
|
||||||
|
.setMessage(R.string.reset_setting_confirmation)
|
||||||
|
.setPositiveButton(android.R.string.ok) { _: DialogInterface, _: Int ->
|
||||||
|
setting.removeOldMapping()
|
||||||
|
notifyItemChanged(position)
|
||||||
|
fragmentView.onSettingChanged()
|
||||||
|
fragmentView.loadSettingsList()
|
||||||
|
}
|
||||||
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
|
.show()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
fun onClickDisabledSetting(isRuntimeDisabled: Boolean) {
|
fun onClickDisabledSetting(isRuntimeDisabled: Boolean) {
|
||||||
val titleId = if (isRuntimeDisabled)
|
val titleId = if (isRuntimeDisabled)
|
||||||
R.string.setting_not_editable
|
R.string.setting_not_editable
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class InputBindingSettingViewHolder(val binding: ListItemSettingBinding, adapter
|
|||||||
|
|
||||||
override fun onLongClick(clicked: View): Boolean {
|
override fun onLongClick(clicked: View): Boolean {
|
||||||
if (setting.isEditable) {
|
if (setting.isEditable) {
|
||||||
adapter.onLongClick(setting.setting!!, bindingAdapterPosition)
|
adapter.onInputBindingLongClick(setting, bindingAdapterPosition)
|
||||||
} else {
|
} else {
|
||||||
adapter.onClickDisabledSetting(!setting.isEditable)
|
adapter.onClickDisabledSetting(!setting.isEditable)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user