From dc73b7ccb2a2eaa3367191c2906c1a78f5282105 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Tue, 19 Feb 2019 04:36:47 +0300 Subject: [PATCH] v0.2.1 pro-active progress bar added --- src/main/java/nsusbloader/MessagesConsumer.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/nsusbloader/MessagesConsumer.java b/src/main/java/nsusbloader/MessagesConsumer.java index 66c6af9..303580a 100644 --- a/src/main/java/nsusbloader/MessagesConsumer.java +++ b/src/main/java/nsusbloader/MessagesConsumer.java @@ -2,6 +2,7 @@ package nsusbloader; import javafx.animation.AnimationTimer; import javafx.scene.control.ProgressBar; +import javafx.scene.control.ProgressIndicator; import javafx.scene.control.TextArea; import nsusbloader.Controllers.NSTableViewController; import nsusbloader.NSLDataTypes.EFileStatus; @@ -34,6 +35,8 @@ public class MessagesConsumer extends AnimationTimer { this.tableViewController = MediatorControl.getInstance().getContoller().tableFilesListController; progressBar.setProgress(0.0); + + progressBar.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS); MediatorControl.getInstance().setTransferActive(true); } @@ -46,8 +49,14 @@ public class MessagesConsumer extends AnimationTimer { ArrayList progress = new ArrayList<>(); int progressRecieved = progressQueue.drainTo(progress); - if (progressRecieved > 0) - progress.forEach(prg -> progressBar.setProgress(prg)); + if (progressRecieved > 0) { + progress.forEach(prg -> { + if (prg != 1.0) + progressBar.setProgress(prg); + else + progressBar.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS); + }); + } if (isInterrupted) { // It's safe 'cuz it's could't be interrupted while HashMap populating MediatorControl.getInstance().setTransferActive(false);