Post event after queue has been persisted
This commit is contained in:
parent
5e5c570c83
commit
5328bd2b06
|
@ -47,7 +47,6 @@ import de.danoeh.antennapod.core.dialog.ConfirmationDialog;
|
|||
import de.danoeh.antennapod.core.dialog.DownloadRequestErrorDialogCreator;
|
||||
import de.danoeh.antennapod.core.event.DownloadEvent;
|
||||
import de.danoeh.antennapod.core.event.DownloaderUpdate;
|
||||
import de.danoeh.antennapod.core.event.FavoritesEvent;
|
||||
import de.danoeh.antennapod.core.event.FeedItemEvent;
|
||||
import de.danoeh.antennapod.core.feed.EventDistributor;
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
|
|
|
@ -350,7 +350,6 @@ public class DBWriter {
|
|||
itemIds.add(item.getId());
|
||||
item.addTag(FeedItem.TAG_QUEUE);
|
||||
}
|
||||
EventBus.getDefault().post(FeedItemEvent.updated(items));
|
||||
return addQueueItem(context, false, itemIds.toArray());
|
||||
}
|
||||
|
||||
|
@ -374,6 +373,7 @@ public class DBWriter {
|
|||
boolean queueModified = false;
|
||||
LongList markAsUnplayedIds = new LongList();
|
||||
List<QueueEvent> events = new ArrayList<>();
|
||||
List<FeedItem> updatedItems = new ArrayList<>();
|
||||
for (int i = 0; i < itemIds.length; i++) {
|
||||
if (!itemListContains(queue, itemIds[i])) {
|
||||
final FeedItem item = DBReader.getFeedItem(itemIds[i]);
|
||||
|
@ -389,6 +389,8 @@ public class DBWriter {
|
|||
queue.add(item);
|
||||
events.add(QueueEvent.added(item, queue.size() - 1));
|
||||
}
|
||||
item.addTag(FeedItem.TAG_QUEUE);
|
||||
updatedItems.add(item);
|
||||
queueModified = true;
|
||||
if (item.isNew()) {
|
||||
markAsUnplayedIds.add(item.getId());
|
||||
|
@ -401,6 +403,7 @@ public class DBWriter {
|
|||
for (QueueEvent event : events) {
|
||||
EventBus.getDefault().post(event);
|
||||
}
|
||||
EventBus.getDefault().post(FeedItemEvent.updated(updatedItems));
|
||||
if (markAsUnplayedIds.size() > 0) {
|
||||
DBWriter.markItemPlayed(FeedItem.UNPLAYED, markAsUnplayedIds.toArray());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue