Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fixed volume keys not being handled by Android if screen keyboard is …

…visible.

See bug #1569.
  • Loading branch information
philippwiesemann committed Aug 4, 2013
1 parent 70bf97e commit 8760185d5fe37caef7dd8700a586328fd4bc592e
Showing with 10 additions and 6 deletions.
  1. +10 −6 android-project/src/org/libsdl/app/SDLActivity.java
@@ -134,6 +134,16 @@ protected void onDestroy() {
}
}

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
int keyCode = event.getKeyCode();
// Ignore volume keys so they're handled by Android
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN ||
keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
return false;
}
return super.dispatchKeyEvent(event);
}

/** Called by onPause or surfaceDestroyed. Even if surfaceDestroyed
* is the first to be called, mIsSurfaceReady should still be set
@@ -726,12 +736,6 @@ public void onDraw(Canvas canvas) {}
// Key events
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {

// Ignore volume keys so they're handled by Android
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN ||
keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
return false;
}

if (event.getAction() == KeyEvent.ACTION_DOWN) {
//Log.v("SDL", "key down: " + keyCode);

0 comments on commit 8760185

Please sign in to comment.