diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2014-06-15 18:22:15 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2014-06-15 18:22:15 +0200 |
commit | 45646d4c26bd23aa84948fa120efd464efcceec9 (patch) | |
tree | 52bbe8ac21b4508cb707fe8298828ffcb8168b43 /src/de | |
parent | cdf663ffa59425b805d77efa02618cb7f9d49962 (diff) | |
download | AntennaPod-45646d4c26bd23aa84948fa120efd464efcceec9.zip |
Only report unknown keycode if PlaybackService is playing
Diffstat (limited to 'src/de')
-rw-r--r-- | src/de/danoeh/antennapod/service/playback/PlaybackService.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/de/danoeh/antennapod/service/playback/PlaybackService.java b/src/de/danoeh/antennapod/service/playback/PlaybackService.java index 04b41ca81..4ecf5db8a 100644 --- a/src/de/danoeh/antennapod/service/playback/PlaybackService.java +++ b/src/de/danoeh/antennapod/service/playback/PlaybackService.java @@ -282,7 +282,8 @@ public class PlaybackService extends Service { if (BuildConfig.DEBUG) Log.d(TAG, "Handling keycode: " + keycode); - final PlayerStatus status = mediaPlayer.getPSMPInfo().playerStatus; + final PlaybackServiceMediaPlayer.PSMPInfo info = mediaPlayer.getPSMPInfo(); + final PlayerStatus status = info.playerStatus; switch (keycode) { case KeyEvent.KEYCODE_HEADSETHOOK: case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: @@ -319,8 +320,10 @@ public class PlaybackService extends Service { mediaPlayer.seekDelta(-UserPreferences.getSeekDeltaMs()); break; default: - String message = String.format(getResources().getString(R.string.unknown_media_key), keycode); - Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); + if (info.playable != null && info.playerStatus == PlayerStatus.PLAYING) { // only notify the user about an unknown key event if it is actually doing something + String message = String.format(getResources().getString(R.string.unknown_media_key), keycode); + Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); + } break; } } |