1
0
Fork 0
mirror of https://github.com/xpipe-io/xpipe.git synced 2025-04-22 12:13:25 +00:00

Improve download progress display

This commit is contained in:
crschnick 2025-03-21 16:52:45 +00:00
parent 5c6acc50e4
commit 474d201708
2 changed files with 9 additions and 7 deletions
app/src/main/java/io/xpipe/app/browser/file

View file

@ -65,13 +65,14 @@ public class BrowserTransferComp extends SimpleComp {
return Bindings.createStringBinding(
() -> {
var p = sourceItem.get().getProgress().getValue();
var progressSuffix = p == null
|| sourceItem
.get()
.downloadFinished()
.get()
var hideProgress = sourceItem
.get()
.downloadFinished()
.get();
var share = p != null ? (p.getTransferred() * 100 / p.getTotal()) : 0;
var progressSuffix = hideProgress
? ""
: " " + (p.getTransferred() * 100 / p.getTotal()) + "%";
: " " + share + "%";
return entry.getFileName() + progressSuffix;
},
sourceItem.get().getProgress());

View file

@ -50,8 +50,9 @@ public class BrowserTransferModel {
}
if (toDownload.isPresent()) {
downloadSingle(toDownload.get());
} else {
ThreadHelper.sleep(20);
}
ThreadHelper.sleep(20);
}
});
thread.start();