Changed behavior of continuous playback
This commit is contained in:
parent
cd7cb59175
commit
243f75b65c
@ -617,6 +617,20 @@ public class FeedManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the item that comes after this item in the queue or null if this
|
||||||
|
* item is not in the queue or if this item has no successor.
|
||||||
|
*/
|
||||||
|
public FeedItem getQueueSuccessorOfItem(FeedItem item) {
|
||||||
|
if (isInQueue(item)) {
|
||||||
|
int itemIndex = queue.indexOf(item);
|
||||||
|
if (itemIndex != -1 && itemIndex < (queue.size() - 1)) {
|
||||||
|
return queue.get(itemIndex + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/** Removes all items in queue */
|
/** Removes all items in queue */
|
||||||
public void clearQueue(final Context context) {
|
public void clearQueue(final Context context) {
|
||||||
if (AppConfig.DEBUG)
|
if (AppConfig.DEBUG)
|
||||||
|
@ -656,6 +656,7 @@ public class PlaybackService extends Service {
|
|||||||
media.setPosition(0);
|
media.setPosition(0);
|
||||||
media.setPlaybackCompletionDate(new Date());
|
media.setPlaybackCompletionDate(new Date());
|
||||||
manager.markItemRead(PlaybackService.this, media.getItem(), true);
|
manager.markItemRead(PlaybackService.this, media.getItem(), true);
|
||||||
|
FeedItem nextItem = manager.getQueueSuccessorOfItem(media.getItem());
|
||||||
boolean isInQueue = manager.isInQueue(media.getItem());
|
boolean isInQueue = manager.isInQueue(media.getItem());
|
||||||
if (isInQueue) {
|
if (isInQueue) {
|
||||||
manager.removeQueueItem(PlaybackService.this, media.getItem());
|
manager.removeQueueItem(PlaybackService.this, media.getItem());
|
||||||
@ -676,7 +677,6 @@ public class PlaybackService extends Service {
|
|||||||
// Prepare for playing next item
|
// Prepare for playing next item
|
||||||
boolean followQueue = prefs.getBoolean(
|
boolean followQueue = prefs.getBoolean(
|
||||||
PodcastApp.PREF_FOLLOW_QUEUE, false);
|
PodcastApp.PREF_FOLLOW_QUEUE, false);
|
||||||
FeedItem nextItem = manager.getFirstQueueItem();
|
|
||||||
boolean playNextItem = isInQueue && followQueue && nextItem != null;
|
boolean playNextItem = isInQueue && followQueue && nextItem != null;
|
||||||
if (playNextItem) {
|
if (playNextItem) {
|
||||||
if (AppConfig.DEBUG)
|
if (AppConfig.DEBUG)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user