diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2024-04-09 22:33:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-09 22:33:31 +0200 |
commit | bd4e9e19d732de045260fcd7fd2870421f0a4d19 (patch) | |
tree | b5cc04cee70649d3fee66203ba26ae25d2315750 | |
parent | e578f4ca93f6292f62e4b4c7fa11d17fe0b27c71 (diff) | |
download | AntennaPod-bd4e9e19d732de045260fcd7fd2870421f0a4d19.zip |
Don't allow downloading already downloaded episdoes again (#7076)
2 files changed, 7 insertions, 2 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/EpisodeMultiSelectActionHandler.java b/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/EpisodeMultiSelectActionHandler.java index 2a9f76939..76ed47de5 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/EpisodeMultiSelectActionHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/EpisodeMultiSelectActionHandler.java @@ -91,12 +91,14 @@ public class EpisodeMultiSelectActionHandler { private void downloadChecked(List<FeedItem> items) { // download the check episodes in the same order as they are currently displayed + int downloaded = 0; for (FeedItem episode : items) { - if (episode.hasMedia() && !episode.getFeed().isLocalFeed()) { + if (episode.hasMedia() && !episode.isDownloaded() && !episode.getFeed().isLocalFeed()) { DownloadServiceInterface.get().download(activity, episode); + downloaded++; } } - showMessage(R.plurals.downloading_batch_label, items.size()); + showMessage(R.plurals.downloading_batch_label, downloaded); } private void deleteChecked(List<FeedItem> items) { diff --git a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/DownloadServiceInterfaceImpl.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/DownloadServiceInterfaceImpl.java index 37a7f30e0..0b5be92b8 100644 --- a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/DownloadServiceInterfaceImpl.java +++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/DownloadServiceInterfaceImpl.java @@ -36,6 +36,9 @@ public class DownloadServiceInterfaceImpl extends DownloadServiceInterface { } public void download(Context context, FeedItem item) { + if (item.isDownloaded()) { + return; + } OneTimeWorkRequest.Builder workRequest = getRequest(context, item); workRequest.setConstraints(getConstraints()); WorkManager.getInstance(context).enqueueUniqueWork(item.getMedia().getDownloadUrl(), |