mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
DownloadableContributionsDownloader: fixed wrong math when downloading partially downloaded files
This commit is contained in:
@ -85,8 +85,8 @@ public class DownloadableContributionsDownloader {
|
|||||||
FileDownloader me = (FileDownloader) o;
|
FileDownloader me = (FileDownloader) o;
|
||||||
String msg = "";
|
String msg = "";
|
||||||
if (me.getDownloadSize() != null) {
|
if (me.getDownloadSize() != null) {
|
||||||
long downloaded = me.getInitialSize() + me.getDownloaded() / 1000;
|
long downloaded = (me.getInitialSize() + me.getDownloaded()) / 1000;
|
||||||
long total = me.getInitialSize() + me.getDownloadSize() / 1000;
|
long total = (me.getInitialSize() + me.getDownloadSize()) / 1000;
|
||||||
msg = format(_("Downloaded {0}kb of {1}kb."), downloaded, total);
|
msg = format(_("Downloaded {0}kb of {1}kb."), downloaded, total);
|
||||||
}
|
}
|
||||||
progress.setStatus(statusText + " " + msg);
|
progress.setStatus(statusText + " " + msg);
|
||||||
|
@ -181,8 +181,9 @@ public class FileDownloader extends Observable {
|
|||||||
|
|
||||||
// Check for valid content length.
|
// Check for valid content length.
|
||||||
long len = connection.getContentLength();
|
long len = connection.getContentLength();
|
||||||
if (len >= 0)
|
if (len >= 0) {
|
||||||
setDownloadSize(len);
|
setDownloadSize(len);
|
||||||
|
}
|
||||||
setStatus(Status.DOWNLOADING);
|
setStatus(Status.DOWNLOADING);
|
||||||
|
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
Reference in New Issue
Block a user