diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2018-05-06 17:37:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-06 17:37:53 +0200 |
commit | b156458d832e54420627b28662d347b774c3e109 (patch) | |
tree | adffd57512f59f02f76ff686b5b4ef81084995a4 /core | |
parent | 930330fbb46a25a7f1d6bce754836efb6f6cbfee (diff) | |
parent | d652bd21842e851802b7a842856726048d7f2498 (diff) | |
download | AntennaPod-b156458d832e54420627b28662d347b774c3e109.zip |
Merge pull request #2646 from vimsick/fast-forward
Fix Bluetooth Forward Skip Button for Android 8
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java index 67a2cdad2..0bd516f4e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java @@ -447,8 +447,7 @@ public class PlaybackService extends MediaBrowserServiceCompat { if (keycode != -1) { Log.d(TAG, "Received media button event"); - handleKeycode(keycode, intent.getIntExtra(MediaButtonReceiver.EXTRA_SOURCE, - InputDeviceCompat.SOURCE_CLASS_NONE)); + handleKeycode(keycode, true); } else if (!flavorHelper.castDisconnect(castDisconnect) && playable != null) { started = true; boolean stream = intent.getBooleanExtra(EXTRA_SHOULD_STREAM, @@ -472,7 +471,7 @@ public class PlaybackService extends MediaBrowserServiceCompat { * Handles media button events * return: keycode was handled */ - private boolean handleKeycode(int keycode, int source) { + private boolean handleKeycode(int keycode, boolean notificationButton) { Log.d(TAG, "Handling keycode: " + keycode); final PlaybackServiceMediaPlayer.PSMPInfo info = mediaPlayer.getPSMPInfo(); final PlayerStatus status = info.playerStatus; @@ -505,7 +504,7 @@ public class PlaybackService extends MediaBrowserServiceCompat { return true; case KeyEvent.KEYCODE_MEDIA_NEXT: - if (source == InputDevice.SOURCE_CLASS_NONE || + if (notificationButton || UserPreferences.shouldHardwareButtonSkip()) { // assume the skip command comes from a notification or the lockscreen // a >| skip button should actually skip @@ -1762,11 +1761,11 @@ public class PlaybackService extends MediaBrowserServiceCompat { public boolean onMediaButtonEvent(final Intent mediaButton) { Log.d(TAG, "onMediaButtonEvent(" + mediaButton + ")"); if (mediaButton != null) { - KeyEvent keyEvent = (KeyEvent) mediaButton.getExtras().get(Intent.EXTRA_KEY_EVENT); + KeyEvent keyEvent = (KeyEvent) mediaButton.getParcelableExtra(Intent.EXTRA_KEY_EVENT); if (keyEvent != null && keyEvent.getAction() == KeyEvent.ACTION_DOWN && keyEvent.getRepeatCount() == 0) { - return handleKeycode(keyEvent.getKeyCode(), keyEvent.getSource()); + return handleKeycode(keyEvent.getKeyCode(), false); } } return false; |