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

View File

@ -524,12 +524,20 @@ 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();
startWhenPrepared = true;
} else {
if (AppConfig.DEBUG)
Log.d(TAG,
"No more episodes available to play; Reloading current episode");
startWhenPrepared = false;
}
int notificationCode = 0; int notificationCode = 0;
if (media.getMime_type().startsWith("audio")) { if (media.getMime_type().startsWith("audio")) {
notificationCode = EXTRA_CODE_AUDIO; notificationCode = EXTRA_CODE_AUDIO;
@ -541,13 +549,11 @@ public class PlaybackService extends Service {
refreshRemoteControlClientState(); refreshRemoteControlClientState();
sendNotificationBroadcast(NOTIFICATION_TYPE_RELOAD, sendNotificationBroadcast(NOTIFICATION_TYPE_RELOAD,
notificationCode); notificationCode);
} else { /*
if (AppConfig.DEBUG) * } else { if (AppConfig.DEBUG) Log.d(TAG, "Stopping playback");
Log.d(TAG, "Stopping playback"); * stopWidgetUpdater(); setStatus(PlayerStatus.STOPPED);
stopWidgetUpdater(); * stopForeground(true); }
setStatus(PlayerStatus.STOPPED); */
stopForeground(true);
}
} }
}; };