update PlaybackServiceCallbacks to be able to handle a cast player activity
This commit is contained in:
parent
8a18adf50c
commit
b3a78d47f9
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user