summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java
index f081331f..8723f515 100644
--- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java
+++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java
@@ -95,11 +95,16 @@ public class DownloadConnector {
long totalBytesRead = 0;
int bufferSize = 8 * 1024;
long bytesRead;
+ int lastProgress = 0;
while ((bytesRead = source.read(sinkBuffer, bufferSize)) != -1) {
sink.emit();
totalBytesRead += bytesRead;
int progress = (int) ((totalBytesRead * 100) / contentLength);
- callback.onUpdate(progress);
+ // debouncing callbacks
+ if (lastProgress < progress) {
+ lastProgress = progress;
+ callback.onUpdate(progress);
+ }
}
sink.flush();