From 3041336b92f84f902c75e897316aa19075f9a34d Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sat, 28 Sep 2019 13:04:40 +0200 Subject: [PATCH] Do not notify cancelled downloads --- .../core/service/download/DownloadService.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java index 0f346893e..37d778fd6 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java @@ -1058,7 +1058,13 @@ public class DownloadService extends Service { private final Runnable postDownloaderTask = new Runnable() { @Override public void run() { - List list = Collections.unmodifiableList(downloads); + List runningDownloads = new ArrayList<>(); + for (Downloader downloader : downloads) { + if (!downloader.cancelled) { + runningDownloads.add(downloader); + } + } + List list = Collections.unmodifiableList(runningDownloads); EventBus.getDefault().postSticky(DownloadEvent.refresh(list)); postHandler.postDelayed(postDownloaderTask, 1500); } @@ -1076,6 +1082,9 @@ public class DownloadService extends Service { private static String compileNotificationString(List downloads) { List lines = new ArrayList<>(downloads.size()); for (Downloader downloader : downloads) { + if (downloader.cancelled) { + continue; + } StringBuilder line = new StringBuilder("• "); DownloadRequest request = downloader.getDownloadRequest(); switch (request.getFeedfileType()) {