diff --git a/src/main/java/me/gekoramy/github/quiz/app/AppDownload.java b/src/main/java/me/gekoramy/github/quiz/app/AppDownload.java index e0bb302..4a47969 100755 --- a/src/main/java/me/gekoramy/github/quiz/app/AppDownload.java +++ b/src/main/java/me/gekoramy/github/quiz/app/AppDownload.java @@ -33,9 +33,9 @@ public void start(Stage stage) { Injector.setConfigurationSource(customProperties::get); DownloadView appView = new DownloadView(); Scene scene = new Scene(appView.getView()); - stage.setHeight(150.0); + stage.setMinHeight(150.0); + stage.setMaxHeight(150.0); stage.setTitle("Download"); - stage.setResizable(false); stage.setScene(scene); stage.show(); } diff --git a/src/main/java/me/gekoramy/github/quiz/app/AppPreview.java b/src/main/java/me/gekoramy/github/quiz/app/AppPreview.java index d302324..86efc13 100755 --- a/src/main/java/me/gekoramy/github/quiz/app/AppPreview.java +++ b/src/main/java/me/gekoramy/github/quiz/app/AppPreview.java @@ -38,10 +38,10 @@ public void start(Stage stage) { PreviewView appView = new PreviewView(); Scene scene = new Scene(appView.getView()); ((PreviewPresenter) appView.getPresenter()).setAccelerators(scene); - stage.setHeight(150.0); + stage.setMinHeight(150.0); + stage.setMaxHeight(150.0); stage.setTitle("Preview"); stage.setScene(scene); - stage.setResizable(false); stage.show(); } diff --git a/src/main/java/me/gekoramy/github/quiz/app/download/download.fxml b/src/main/java/me/gekoramy/github/quiz/app/download/download.fxml index caf4de2..1904069 100755 --- a/src/main/java/me/gekoramy/github/quiz/app/download/download.fxml +++ b/src/main/java/me/gekoramy/github/quiz/app/download/download.fxml @@ -5,30 +5,22 @@ - + - + - - - - - - - - - + - - - - + diff --git a/src/main/java/me/gekoramy/github/quiz/app/preview/PreviewPresenter.java b/src/main/java/me/gekoramy/github/quiz/app/preview/PreviewPresenter.java index 6760b17..28382a4 100755 --- a/src/main/java/me/gekoramy/github/quiz/app/preview/PreviewPresenter.java +++ b/src/main/java/me/gekoramy/github/quiz/app/preview/PreviewPresenter.java @@ -50,6 +50,8 @@ public class PreviewPresenter implements Initializable { @FXML private Hyperlink btnRefresh; @FXML + private Hyperlink btnShuffle; + @FXML private Hyperlink btnDownload; @FXML private Hyperlink btnStart; @@ -92,6 +94,9 @@ public void initialize(URL location, ResourceBundle resources) { progress.progressProperty().bind(examStarter.getQuestionPool().progressProperty()); + btnRefresh.managedProperty().bindBidirectional(btnRefresh.visibleProperty()); + btnDownload.managedProperty().bindBidirectional(btnDownload.visibleProperty()); + updateAvailable.valueProperty().addListener((value, oldValue, newValue) -> { if (newValue != null && newValue) { btnDownload.visibleProperty().set(true); @@ -108,6 +113,7 @@ public void initialize(URL location, ResourceBundle resources) { btnStore.setOnAction(e -> onStore()); btnDownload.setOnAction(e -> onDownload()); btnRefresh.setOnAction(e -> onRefresh()); + btnShuffle.setOnAction(e -> onShuffle()); btnStart.setOnAction(e -> onStart()); } @@ -180,4 +186,8 @@ private void onRefresh() { } } } + + private void onShuffle() { + examStarter.shuffle(); + } } diff --git a/src/main/java/me/gekoramy/github/quiz/app/preview/preview.fxml b/src/main/java/me/gekoramy/github/quiz/app/preview/preview.fxml index ebbcac7..f96cd06 100755 --- a/src/main/java/me/gekoramy/github/quiz/app/preview/preview.fxml +++ b/src/main/java/me/gekoramy/github/quiz/app/preview/preview.fxml @@ -13,76 +13,74 @@ progress="1"/> - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + diff --git a/src/main/java/me/gekoramy/github/quiz/service/ExamStarter.java b/src/main/java/me/gekoramy/github/quiz/service/ExamStarter.java index fea628d..0064cb3 100755 --- a/src/main/java/me/gekoramy/github/quiz/service/ExamStarter.java +++ b/src/main/java/me/gekoramy/github/quiz/service/ExamStarter.java @@ -47,4 +47,8 @@ protected Void call() { } }; } + + public void shuffle() { + questionPool.shuffle(); + } } diff --git a/src/main/java/me/gekoramy/github/quiz/util/Pool.java b/src/main/java/me/gekoramy/github/quiz/util/Pool.java index b5cf157..c7eb61b 100755 --- a/src/main/java/me/gekoramy/github/quiz/util/Pool.java +++ b/src/main/java/me/gekoramy/github/quiz/util/Pool.java @@ -54,7 +54,6 @@ public DoubleProperty progressProperty() { public void revert() { toDoList.clear(); toDoList.addAll(totalList); - Collections.shuffle(toDoList); this.progress.set(1); } @@ -76,4 +75,8 @@ public List retrieve(int many) { public boolean isDone() { return toDoList.size() == 0; } + + public void shuffle() { + Collections.shuffle(toDoList); + } }