diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-10-02 11:16:05 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-10-02 11:16:05 +0200 |
commit | 2b69696359e674aa1737909c33625965ee15ff65 (patch) | |
tree | fe85a2be701d64b84feda2a20e46a5db1d8b0a2a /src | |
parent | d34746e0494c293403ef1c7ba15f03947b878c5e (diff) | |
download | AntennaPod-2b69696359e674aa1737909c33625965ee15ff65.zip |
Added support for play/pause key on wired headset
Diffstat (limited to 'src')
-rw-r--r-- | src/de/danoeh/antennapod/service/PlaybackService.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/de/danoeh/antennapod/service/PlaybackService.java b/src/de/danoeh/antennapod/service/PlaybackService.java index 789b1c952..f4e5fb93f 100644 --- a/src/de/danoeh/antennapod/service/PlaybackService.java +++ b/src/de/danoeh/antennapod/service/PlaybackService.java @@ -411,12 +411,17 @@ public class PlaybackService extends Service { /** Handles media button events */ private void handleKeycode(int keycode) { + if (AppConfig.DEBUG) + Log.d(TAG, "Handling keycode: " + keycode); switch (keycode) { + case KeyEvent.KEYCODE_HEADSETHOOK: case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: if (status == PlayerStatus.PLAYING) { pause(false); } else if (status == PlayerStatus.PAUSED) { play(); + } else if (status == PlayerStatus.PREPARING) { + setStartWhenPrepared(!startWhenPrepared); } break; case KeyEvent.KEYCODE_MEDIA_PLAY: @@ -732,6 +737,7 @@ public class PlaybackService extends Service { /** * Saves the current position and pauses playback. Note that, if audiofocus * is abandoned, the lockscreen controls will also disapear. + * * @param abandonFocus * is true if the service should release audio focus */ @@ -976,7 +982,7 @@ public class PlaybackService extends Service { .editMetadata(false); editor.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, media.getItem().getTitle()); - + editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, media.getItem().getFeed().getTitle()); |