From c32239be0ed0ac0b9ca44c84fb3f032a3188eb38 Mon Sep 17 00:00:00 2001 From: Tony Tam <149837+tonytamsf@users.noreply.github.com> Date: Sun, 24 Jan 2021 03:27:37 -0800 Subject: [PATCH] Android auto skip button (#4865) --- .../antennapod/core/service/playback/PlaybackService.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 4e26f12e5..495ac40c7 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 @@ -1240,7 +1240,8 @@ public class PlaybackService extends MediaBrowserServiceCompat { capabilities = capabilities | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS; } - UiModeManager uiModeManager = (UiModeManager) getApplicationContext().getSystemService(Context.UI_MODE_SERVICE); + UiModeManager uiModeManager = (UiModeManager) getApplicationContext() + .getSystemService(Context.UI_MODE_SERVICE); if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_CAR) { sessionState.addCustomAction( new PlaybackStateCompat.CustomAction.Builder( @@ -1908,7 +1909,10 @@ public class PlaybackService extends MediaBrowserServiceCompat { @Override public void onSkipToNext() { Log.d(TAG, "onSkipToNext()"); - if (UserPreferences.shouldHardwareButtonSkip()) { + UiModeManager uiModeManager = (UiModeManager) getApplicationContext() + .getSystemService(Context.UI_MODE_SERVICE); + if (UserPreferences.shouldHardwareButtonSkip() + || uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_CAR) { mediaPlayer.skip(); } else { seekDelta(UserPreferences.getFastForwardSecs() * 1000);