summaryrefslogtreecommitdiff
path: root/Source/Android/src
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2013-08-26 13:19:06 -0400
committerLioncash <mathew1800@gmail.com>2013-08-26 13:19:06 -0400
commit670b0284929bae65c08e4d6c12c210d89d068d3c (patch)
treedd14b55bee9469adb33c15d73bc4c37051912d57 /Source/Android/src
parente12c66b6cf0276c85b1dcb1a255c6c5c24647711 (diff)
[Android] Remove the explicit key event listener from InputConfigFragment. The AlertDialog class has a key listener built into it.
Also documented the methods/interfaces in MotionAlertDialog.
Diffstat (limited to 'Source/Android/src')
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/settings/InputConfigFragment.java34
1 files changed, 19 insertions, 15 deletions
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/InputConfigFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/InputConfigFragment.java
index 5340fb9b6c..8914c496b9 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/settings/InputConfigFragment.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/InputConfigFragment.java
@@ -99,9 +99,9 @@ public final class InputConfigFragment extends PreferenceFragment
final MotionAlertDialog dialog = new MotionAlertDialog(m_activity);
// Set the key listener
- dialog.setOnKeyEventListener(new MotionAlertDialog.OnKeyEventListener()
+ dialog.setOnKeyListener(new AlertDialog.OnKeyListener()
{
- public boolean onKey(KeyEvent event)
+ public boolean onKey(DialogInterface dlg, int keyCode, KeyEvent event)
{
Log.d("InputConfigFragment", "Received key event: " + event.getAction());
switch (event.getAction())
@@ -211,38 +211,42 @@ public final class InputConfigFragment extends PreferenceFragment
*/
protected static final class MotionAlertDialog extends AlertDialog
{
- private OnKeyEventListener keyListener;
private OnMotionEventListener motionListener;
+ /**
+ * Constructor
+ *
+ * @param ctx context to use this dialog in.
+ */
public MotionAlertDialog(Context ctx)
{
super(ctx);
}
- public interface OnKeyEventListener
- {
- boolean onKey(KeyEvent event);
- }
-
+ /**
+ * Interface which defines a callback method for general
+ * motion events. This allows motion event code to be set
+ * in the event anonymous classes of this dialog are used.
+ */
public interface OnMotionEventListener
{
boolean onMotion(MotionEvent event);
}
- public void setOnKeyEventListener(OnKeyEventListener listener)
- {
- this.keyListener = listener;
- }
-
+ /**
+ * Sets the motion listener.
+ *
+ * @param listener The motion listener to set.
+ */
public void setOnMotionEventListener(OnMotionEventListener listener)
{
this.motionListener = listener;
}
-
+
@Override
public boolean dispatchKeyEvent(KeyEvent event)
{
- if (keyListener.onKey(event))
+ if (this.onKeyDown(event.getKeyCode(), event))
return true;
return super.dispatchKeyEvent(event);