set progress listener state in same thread

This commit is contained in:
woodser 2023-12-29 07:09:47 -05:00
parent 7f3fd0af08
commit 5466689857

View File

@ -11,11 +11,11 @@ public class DownloadListener {
private final DoubleProperty percentage = new SimpleDoubleProperty(-1); private final DoubleProperty percentage = new SimpleDoubleProperty(-1);
public void progress(double percentage, long blocksLeft, Date date) { public void progress(double percentage, long blocksLeft, Date date) {
UserThread.execute(() -> this.percentage.set(percentage / 100d)); UserThread.await(() -> this.percentage.set(percentage / 100d));
} }
public void doneDownload() { public void doneDownload() {
UserThread.execute(() -> this.percentage.set(1d)); UserThread.await(() -> this.percentage.set(1d));
} }
public ReadOnlyDoubleProperty percentageProperty() { public ReadOnlyDoubleProperty percentageProperty() {