Add method to cancel downloading of multiple items

This commit is contained in:
Alex Sytnyk 2018-05-07 16:26:03 +03:00
parent 178690a9e4
commit 0f3376a427

View file

@ -283,6 +283,22 @@ public class DownloadIndexesThread {
} }
} }
public void cancelDownload(List<IndexItem> items) {
if (items != null) {
boolean updateProgress = false;
for (IndexItem item : items) {
if (currentDownloadingItem == item) {
downloadFileHelper.setInterruptDownloading(true);
} else {
indexItemDownloading.remove(item);
updateProgress = true;
}
}
if (updateProgress) {
downloadInProgress();
}
}
}
public IndexItem getCurrentDownloadingItem() { public IndexItem getCurrentDownloadingItem() {
return currentDownloadingItem; return currentDownloadingItem;