summaryrefslogtreecommitdiff
path: root/Source/Android/app/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Android/app/src/main/java/org')
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/MotionAlertDialog.java28
1 files changed, 27 insertions, 1 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/MotionAlertDialog.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/MotionAlertDialog.java
index cd97b77197..8f86db31d3 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/MotionAlertDialog.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/MotionAlertDialog.java
@@ -11,6 +11,7 @@ import android.view.MotionEvent;
import org.dolphinemu.dolphinemu.features.settings.model.view.InputBindingSetting;
import org.dolphinemu.dolphinemu.utils.ControllerMappingHelper;
import org.dolphinemu.dolphinemu.utils.Log;
+import org.dolphinemu.dolphinemu.utils.TvUtil;
import java.util.ArrayList;
import java.util.List;
@@ -45,7 +46,7 @@ public final class MotionAlertDialog extends AlertDialog
Log.debug("[MotionAlertDialog] Received key event: " + event.getAction());
switch (event.getAction())
{
- case KeyEvent.ACTION_DOWN:
+ case KeyEvent.ACTION_UP:
if (!ControllerMappingHelper.shouldKeyBeIgnored(event.getDevice(), keyCode))
{
saveKeyInput(event);
@@ -59,6 +60,21 @@ public final class MotionAlertDialog extends AlertDialog
}
@Override
+ public boolean onKeyLongPress(int keyCode, KeyEvent event)
+ {
+ // Option to clear by long back is only needed on the TV interface
+ if (TvUtil.isLeanback(getContext()))
+ {
+ if (keyCode == KeyEvent.KEYCODE_BACK)
+ {
+ clearBinding();
+ return true;
+ }
+ }
+ return super.onKeyLongPress(keyCode, event);
+ }
+
+ @Override
public boolean dispatchKeyEvent(KeyEvent event)
{
// Handle this key if we care about it, otherwise pass it down the framework
@@ -197,4 +213,14 @@ public final class MotionAlertDialog extends AlertDialog
dismiss();
}
+
+ private void clearBinding()
+ {
+ setting.setValue("");
+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.remove(setting.getKey());
+ editor.apply();
+ dismiss();
+ }
}