diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2013-03-07 16:01:14 +0100 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2013-03-07 16:01:14 +0100 |
commit | 58747d227a123f6a1ef3641e2941115bb52aace1 (patch) | |
tree | 23b7bf62bd2d038893c9c60d5ea00393394fa70e | |
parent | 9dec0546bd76a6987a0b14e68a94965778a36a0e (diff) | |
download | AntennaPod-58747d227a123f6a1ef3641e2941115bb52aace1.zip |
Add item to queue once it's downloaded
-rw-r--r-- | src/de/danoeh/antennapod/feed/FeedManager.java | 6 | ||||
-rw-r--r-- | src/de/danoeh/antennapod/service/download/DownloadService.java | 9 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/de/danoeh/antennapod/feed/FeedManager.java b/src/de/danoeh/antennapod/feed/FeedManager.java index 9b66c904b..32e7f88f1 100644 --- a/src/de/danoeh/antennapod/feed/FeedManager.java +++ b/src/de/danoeh/antennapod/feed/FeedManager.java @@ -570,7 +570,6 @@ public class FeedManager { /** Downloads FeedItems if they have not been downloaded yet. */ public void downloadFeedItem(final Context context, FeedItem... items) throws DownloadRequestException { - List<FeedItem> addToQueue = new ArrayList<FeedItem>(); for (FeedItem item : items) { if (item.getMedia() != null @@ -591,13 +590,8 @@ public class FeedManager { } else { requester.downloadMedia(context, item.getMedia()); } - addToQueue.add(item); } } - if (UserPreferences.isAutoQueue()) { - addQueueItem(context, - addToQueue.toArray(new FeedItem[addToQueue.size()])); - } } /** diff --git a/src/de/danoeh/antennapod/service/download/DownloadService.java b/src/de/danoeh/antennapod/service/download/DownloadService.java index 986491fb5..0aa06985d 100644 --- a/src/de/danoeh/antennapod/service/download/DownloadService.java +++ b/src/de/danoeh/antennapod/service/download/DownloadService.java @@ -58,6 +58,7 @@ import de.danoeh.antennapod.feed.FeedImage; import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.feed.FeedManager; import de.danoeh.antennapod.feed.FeedMedia; +import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.storage.DownloadRequestException; import de.danoeh.antennapod.storage.DownloadRequester; import de.danoeh.antennapod.syndication.handler.FeedHandler; @@ -831,7 +832,7 @@ public class DownloadService extends Service { } finally { mediaplayer.release(); } - + if (media.getItem().getChapters() == null) { ChapterUtils.loadChaptersFromFileUrl(media); if (media.getItem().getChapters() != null) { @@ -847,6 +848,12 @@ public class DownloadService extends Service { manager.setFeedMedia(DownloadService.this, media); } + if (UserPreferences.isAutoQueue() + && !FeedManager.getInstance().isInQueue(media.getItem())) { + FeedManager.getInstance().addQueueItem(DownloadService.this, + media.getItem()); + } + downloadsBeingHandled -= 1; handler.post(new Runnable() { |