Merge pull request #4707 from tonytamsf/pause-button-android-auto
pause button for autos
This commit is contained in:
commit
28064ffa19
|
@ -150,7 +150,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
public static final String ACTION_PAUSE_PLAY_CURRENT_EPISODE = "action.de.danoeh.antennapod.core.service.pausePlayCurrentEpisode";
|
||||
|
||||
/**
|
||||
* Custom action used by Android Wear
|
||||
* Custom action used by Android Wear, Android Auto
|
||||
*/
|
||||
private static final String CUSTOM_ACTION_FAST_FORWARD = "action.de.danoeh.antennapod.core.service.fastForward";
|
||||
private static final String CUSTOM_ACTION_REWIND = "action.de.danoeh.antennapod.core.service.rewind";
|
||||
|
@ -1222,6 +1222,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
sessionState.setState(state, getCurrentPosition(), getCurrentPlaybackSpeed());
|
||||
long capabilities = PlaybackStateCompat.ACTION_PLAY_PAUSE
|
||||
| PlaybackStateCompat.ACTION_REWIND
|
||||
| PlaybackStateCompat.ACTION_PAUSE
|
||||
| PlaybackStateCompat.ACTION_FAST_FORWARD
|
||||
| PlaybackStateCompat.ACTION_SKIP_TO_NEXT
|
||||
| PlaybackStateCompat.ACTION_SEEK_TO;
|
||||
|
@ -1252,17 +1253,24 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
CUSTOM_ACTION_FAST_FORWARD,
|
||||
getString(R.string.fast_forward_label), R.drawable.ic_notification_fast_forward)
|
||||
.build());
|
||||
} else {
|
||||
// This would give the PIP of videos a play button
|
||||
capabilities = capabilities | PlaybackStateCompat.ACTION_PLAY;
|
||||
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_WATCH) {
|
||||
flavorHelper.sessionStateAddActionForWear(sessionState,
|
||||
CUSTOM_ACTION_REWIND,
|
||||
getString(R.string.rewind_label),
|
||||
android.R.drawable.ic_media_rew);
|
||||
flavorHelper.sessionStateAddActionForWear(sessionState,
|
||||
CUSTOM_ACTION_FAST_FORWARD,
|
||||
getString(R.string.fast_forward_label),
|
||||
android.R.drawable.ic_media_ff);
|
||||
flavorHelper.mediaSessionSetExtraForWear(mediaSession);
|
||||
}
|
||||
}
|
||||
|
||||
sessionState.setActions(capabilities);
|
||||
|
||||
flavorHelper.sessionStateAddActionForWear(sessionState,
|
||||
CUSTOM_ACTION_REWIND, getString(R.string.rewind_label), android.R.drawable.ic_media_rew);
|
||||
flavorHelper.sessionStateAddActionForWear(sessionState,
|
||||
CUSTOM_ACTION_FAST_FORWARD, getString(R.string.fast_forward_label), android.R.drawable.ic_media_ff);
|
||||
|
||||
flavorHelper.mediaSessionSetExtraForWear(mediaSession);
|
||||
|
||||
mediaSession.setPlaybackState(sessionState.build());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue