Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed bug 1569 - Android volume keys not honoured inside SDL
Browse files Browse the repository at this point in the history
Joseba Garc?a Echebarria

The current version of SDL HG in Android doesn't do anything when volume keys are pressed.
The change makes SDL ignore volume keys so that they're handled by the OS and the sound volume can be changed within an app.
  • Loading branch information
slouken committed Aug 1, 2013
1 parent ea9b11f commit dc621d9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions android-project/src/org/libsdl/app/SDLActivity.java
Expand Up @@ -711,6 +711,12 @@ public void onDraw(Canvas canvas) {}
@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);
SDLActivity.onNativeKeyDown(keyCode);
Expand Down

0 comments on commit dc621d9

Please sign in to comment.