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