Allow to resume downloads when a connection is again available
This commit is contained in:
@@ -30,6 +30,14 @@ public class DownloadQueue {
|
||||
return queue;
|
||||
}
|
||||
|
||||
public void clearSuccessfulDownloads() {
|
||||
for (Download download : queue) {
|
||||
if (download.getStatus() == Download.DOWNLOADED) {
|
||||
remove(download);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Observable<Download> getActiveDownloads() {
|
||||
return Observable.from(queue)
|
||||
.filter(download -> download.getStatus() == Download.DOWNLOADING);
|
||||
|
||||
@@ -69,6 +69,10 @@ public class Page implements NetworkHelper.ProgressListener {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setProgress(int value) {
|
||||
progress = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(long bytesRead, long contentLength, boolean done) {
|
||||
progress = (int) ((100 * bytesRead) / contentLength);
|
||||
|
||||
Reference in New Issue
Block a user