summaryrefslogtreecommitdiff
path: root/app/src/fatweb/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/fatweb/java')
-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();