Fixed key down closing messagebox dialog instead of key up on Android.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Sun, 14 Sep 2014 19:44:53 +0200
changeset 91425bf21e9e191f
parent 9141 8a6af8841969
child 9143 b664273a455c
Fixed key down closing messagebox dialog instead of key up on Android.

This fixed sending key up event to SDL a dialog closed by down did not consume.
android-project/src/org/libsdl/app/SDLActivity.java
     1.1 --- a/android-project/src/org/libsdl/app/SDLActivity.java	Sun Sep 14 13:10:21 2014 -0400
     1.2 +++ b/android-project/src/org/libsdl/app/SDLActivity.java	Sun Sep 14 19:44:53 2014 +0200
     1.3 @@ -771,8 +771,10 @@
     1.4              public boolean onKey(DialogInterface d, int keyCode, KeyEvent event) {
     1.5                  Button button = mapping.get(keyCode);
     1.6                  if (button != null) {
     1.7 -                    button.performClick();
     1.8 -                    return true;
     1.9 +                    if (event.getAction() == KeyEvent.ACTION_UP) {
    1.10 +                        button.performClick();
    1.11 +                    }
    1.12 +                    return true; // also for ignored actions
    1.13                  }
    1.14                  return false;
    1.15              }