diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2015-11-23 21:38:36 +0100 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2015-11-23 21:38:36 +0100 |
commit | 506b82124979f912f350eeeba229b0f881c80456 (patch) | |
tree | 7624987f4eab56fcb74aa46473bc969f013172e4 /core | |
parent | 59e0615a40e774f81df8a88ef6278599cc39897e (diff) | |
download | AntennaPod-506b82124979f912f350eeeba229b0f881c80456.zip |
Reformat
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java | 107 |
1 files changed, 51 insertions, 56 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java index df3dbfa69..63b43e9d2 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java @@ -1240,71 +1240,66 @@ public class PlaybackServiceMediaPlayer implements SharedPreferences.OnSharedPre } }; - public boolean handleMediaKey(KeyEvent event) { - if (event != null - && event.getAction() == KeyEvent.ACTION_DOWN - && event.getRepeatCount() == 0) { - switch (event.getKeyCode()) { - case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: - case KeyEvent.KEYCODE_HEADSETHOOK: - { - Log.d(TAG, "Received Play/Pause event from RemoteControlClient"); - if (playerStatus == PlayerStatus.PAUSED || playerStatus == PlayerStatus.PREPARED) { - resume(); - } else if (playerStatus == PlayerStatus.INITIALIZED) { - setStartWhenPrepared(true); - prepare(); - } else if (playerStatus == PlayerStatus.PLAYING) { - pause(false, true); - if (UserPreferences.isPersistNotify()) { - pause(false, true); - } else { - pause(true, true); - } - } - return true; - } - case KeyEvent.KEYCODE_MEDIA_PLAY: - { - Log.d(TAG, "Received Play event from RemoteControlClient"); - if (playerStatus == PlayerStatus.PAUSED || playerStatus == PlayerStatus.PREPARED) { - resume(); - } else if (playerStatus == PlayerStatus.INITIALIZED) { - setStartWhenPrepared(true); - prepare(); - } - return true; - } - case KeyEvent.KEYCODE_MEDIA_PAUSE: - { - Log.d(TAG, "Received Pause event from RemoteControlClient"); - if (playerStatus == PlayerStatus.PLAYING) { - pause(false, true); - } + public boolean handleMediaKey(KeyEvent event) { + if (event != null + && event.getAction() == KeyEvent.ACTION_DOWN + && event.getRepeatCount() == 0) { + switch (event.getKeyCode()) { + case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: + case KeyEvent.KEYCODE_HEADSETHOOK: { + Log.d(TAG, "Received Play/Pause event from RemoteControlClient"); + if (playerStatus == PlayerStatus.PAUSED || playerStatus == PlayerStatus.PREPARED) { + resume(); + } else if (playerStatus == PlayerStatus.INITIALIZED) { + setStartWhenPrepared(true); + prepare(); + } else if (playerStatus == PlayerStatus.PLAYING) { + pause(false, true); if (UserPreferences.isPersistNotify()) { pause(false, true); } else { pause(true, true); } - return true; } - case KeyEvent.KEYCODE_MEDIA_STOP: - { - Log.d(TAG, "Received Stop event from RemoteControlClient"); - stop(); - return true; + return true; + } + case KeyEvent.KEYCODE_MEDIA_PLAY: { + Log.d(TAG, "Received Play event from RemoteControlClient"); + if (playerStatus == PlayerStatus.PAUSED || playerStatus == PlayerStatus.PREPARED) { + resume(); + } else if (playerStatus == PlayerStatus.INITIALIZED) { + setStartWhenPrepared(true); + prepare(); + } + return true; + } + case KeyEvent.KEYCODE_MEDIA_PAUSE: { + Log.d(TAG, "Received Pause event from RemoteControlClient"); + if (playerStatus == PlayerStatus.PLAYING) { + pause(false, true); } - case KeyEvent.KEYCODE_MEDIA_NEXT: - { - Log.d(TAG, "Received next event from RemoteControlClient"); - endPlayback(true); - return true; + if (UserPreferences.isPersistNotify()) { + pause(false, true); + } else { + pause(true, true); } - default: - Log.d(TAG, "Unhandled key code: " + event.getKeyCode()); - break; + return true; } + case KeyEvent.KEYCODE_MEDIA_STOP: { + Log.d(TAG, "Received Stop event from RemoteControlClient"); + stop(); + return true; + } + case KeyEvent.KEYCODE_MEDIA_NEXT: { + Log.d(TAG, "Received next event from RemoteControlClient"); + endPlayback(true); + return true; + } + default: + Log.d(TAG, "Unhandled key code: " + event.getKeyCode()); + break; } - return false; } + return false; + } } |