update PlaybackServiceCallbacks to be able to handle a cast player activity

This commit is contained in:
Domingos Lopes 2016-04-16 11:29:17 -04:00
parent 8a18adf50c
commit b3a78d47f9
3 changed files with 11 additions and 6 deletions

View File

@ -12,7 +12,11 @@ import de.danoeh.antennapod.core.feed.MediaType;
public class PlaybackServiceCallbacksImpl implements PlaybackServiceCallbacks {
@Override
public Intent getPlayerActivityIntent(Context context, MediaType mediaType) {
public Intent getPlayerActivityIntent(Context context, MediaType mediaType, boolean remotePlayback) {
if (remotePlayback) {
// TODO possibly switch to a proper cast activity
return new Intent(context, AudioplayerActivity.class);
}
if (mediaType == MediaType.VIDEO) {
return new Intent(context, VideoplayerActivity.class);
} else {

View File

@ -15,9 +15,10 @@ public interface PlaybackServiceCallbacks {
* type of media that is being played.
*
* @param mediaType The type of media that is being played.
* @param remotePlayback true if the media is played on a remote device.
* @return A non-null activity intent.
*/
Intent getPlayerActivityIntent(Context context, MediaType mediaType);
Intent getPlayerActivityIntent(Context context, MediaType mediaType, boolean remotePlayback);
/**
* Returns true if the PlaybackService should load new episodes from the queue when playback ends

View File

@ -235,12 +235,12 @@ public class PlaybackService extends Service {
*/
public static Intent getPlayerActivityIntent(Context context) {
if (isRunning) {
return ClientConfig.playbackServiceCallbacks.getPlayerActivityIntent(context, currentMediaType);
return ClientConfig.playbackServiceCallbacks.getPlayerActivityIntent(context, currentMediaType, isCasting);
} else {
if (PlaybackPreferences.getCurrentEpisodeIsVideo()) {
return ClientConfig.playbackServiceCallbacks.getPlayerActivityIntent(context, MediaType.VIDEO);
return ClientConfig.playbackServiceCallbacks.getPlayerActivityIntent(context, MediaType.VIDEO, isCasting);
} else {
return ClientConfig.playbackServiceCallbacks.getPlayerActivityIntent(context, MediaType.AUDIO);
return ClientConfig.playbackServiceCallbacks.getPlayerActivityIntent(context, MediaType.AUDIO, isCasting);
}
}
}
@ -251,7 +251,7 @@ public class PlaybackService extends Service {
*/
public static Intent getPlayerActivityIntent(Context context, Playable media) {
MediaType mt = media.getMediaType();
return ClientConfig.playbackServiceCallbacks.getPlayerActivityIntent(context, mt);
return ClientConfig.playbackServiceCallbacks.getPlayerActivityIntent(context, mt, isCasting);
}
@Override