diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-08-19 13:38:20 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-08-19 13:38:20 +0200 |
commit | c77247126892152caf644b34150244cb2cdb7d25 (patch) | |
tree | 2e922c692e166b11a9a6c71569bf91298df48bdf | |
parent | 663993afb25f8ec50678b44399c6538d1b9bd71c (diff) | |
download | AntennaPod-c77247126892152caf644b34150244cb2cdb7d25.zip |
PlaybackService will now reload the last episode if no more episodes are
available
-rw-r--r-- | src/de/danoeh/antennapod/service/PlaybackService.java | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/de/danoeh/antennapod/service/PlaybackService.java b/src/de/danoeh/antennapod/service/PlaybackService.java index b1299402c..8164ffae2 100644 --- a/src/de/danoeh/antennapod/service/PlaybackService.java +++ b/src/de/danoeh/antennapod/service/PlaybackService.java @@ -524,30 +524,36 @@ 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(); - 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); + startWhenPrepared = true; } else { if (AppConfig.DEBUG) - Log.d(TAG, "Stopping playback"); - stopWidgetUpdater(); - setStatus(PlayerStatus.STOPPED); - stopForeground(true); + 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; + 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); } + */ } }; |