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