Android auto skip button (#4865)
This commit is contained in:
parent
a36d66bf35
commit
c32239be0e
|
@ -1240,7 +1240,8 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
||||||
capabilities = capabilities | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS;
|
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) {
|
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_CAR) {
|
||||||
sessionState.addCustomAction(
|
sessionState.addCustomAction(
|
||||||
new PlaybackStateCompat.CustomAction.Builder(
|
new PlaybackStateCompat.CustomAction.Builder(
|
||||||
|
@ -1908,7 +1909,10 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
||||||
@Override
|
@Override
|
||||||
public void onSkipToNext() {
|
public void onSkipToNext() {
|
||||||
Log.d(TAG, "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();
|
mediaPlayer.skip();
|
||||||
} else {
|
} else {
|
||||||
seekDelta(UserPreferences.getFastForwardSecs() * 1000);
|
seekDelta(UserPreferences.getFastForwardSecs() * 1000);
|
||||||
|
|
Loading…
Reference in New Issue