1
0
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:
Federico Fissore 2015-03-24 10:27:11 +01:00
parent e646ca2525
commit ed3d467329
2 changed files with 4 additions and 3 deletions

View File

@ -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);

View File

@ -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) {