Skip to content

Commit

Permalink
close progressbar will force update UI
Browse files Browse the repository at this point in the history
  • Loading branch information
kmtong authored and ctongfei committed Oct 31, 2021
1 parent b960a9b commit 7bfde4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/me/tongfei/progressbar/ProgressBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ public void close() {
scheduledTask.cancel(false);
progress.kill();
try {
action.setForceRefresh();
Util.executor.schedule(action, 0, TimeUnit.NANOSECONDS).get();
} catch (InterruptedException | ExecutionException e) { /* NOOP */ }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ private void refresh() {
// else do nothing: only print when actual progress is made (#91).
}

public void setForceRefresh() {
last = -1;
}

public void run() {
if (!progress.paused) refresh();
if (!progress.alive) {
Expand Down

0 comments on commit 7bfde4a

Please sign in to comment.