PlaybackService will now reload the last episode if no more episodes are

available
This commit is contained in:
daniel oeh 2012-08-19 13:38:20 +02:00
parent 663993afb2
commit c772471268
1 changed files with 22 additions and 16 deletions

View File

@ -524,30 +524,36 @@ public class PlaybackService extends Service {
.getDefaultSharedPreferences(getApplicationContext()) .getDefaultSharedPreferences(getApplicationContext())
.getBoolean(PodcastApp.PREF_FOLLOW_QUEUE, false); .getBoolean(PodcastApp.PREF_FOLLOW_QUEUE, false);
FeedItem nextItem = manager.getFirstQueueItem(); FeedItem nextItem = manager.getFirstQueueItem();
if (isInQueue && followQueue && nextItem != null) { boolean playNextItem = isInQueue && followQueue && nextItem != null;
if (playNextItem) {
if (AppConfig.DEBUG) if (AppConfig.DEBUG)
Log.d(TAG, "Loading next item in queue"); Log.d(TAG, "Loading next item in queue");
media = nextItem.getMedia(); media = nextItem.getMedia();
feed = nextItem.getFeed(); feed = nextItem.getFeed();
shouldStream = !media.isDownloaded(); shouldStream = !media.isDownloaded();
int notificationCode = 0; startWhenPrepared = true;
if (media.getMime_type().startsWith("audio")) {
notificationCode = EXTRA_CODE_AUDIO;
playingVideo = false;
} else if (media.getMime_type().startsWith("video")) {
notificationCode = EXTRA_CODE_VIDEO;
}
resetVideoSurface();
refreshRemoteControlClientState();
sendNotificationBroadcast(NOTIFICATION_TYPE_RELOAD,
notificationCode);
} else { } else {
if (AppConfig.DEBUG) if (AppConfig.DEBUG)
Log.d(TAG, "Stopping playback"); Log.d(TAG,
stopWidgetUpdater(); "No more episodes available to play; Reloading current episode");
setStatus(PlayerStatus.STOPPED); startWhenPrepared = false;
stopForeground(true);
} }
int notificationCode = 0;
if (media.getMime_type().startsWith("audio")) {
notificationCode = EXTRA_CODE_AUDIO;
playingVideo = false;
} else if (media.getMime_type().startsWith("video")) {
notificationCode = EXTRA_CODE_VIDEO;
}
resetVideoSurface();
refreshRemoteControlClientState();
sendNotificationBroadcast(NOTIFICATION_TYPE_RELOAD,
notificationCode);
/*
* } else { if (AppConfig.DEBUG) Log.d(TAG, "Stopping playback");
* stopWidgetUpdater(); setStatus(PlayerStatus.STOPPED);
* stopForeground(true); }
*/
} }
}; };