Skip to content

Commit

Permalink
Merge pull request #655 from dlsc-software-consulting-gmbh/enhancemen…
Browse files Browse the repository at this point in the history
…t-add-simplified-launch-page

Add first-time setup and update UI to MobileRefreshPage
  • Loading branch information
dlemmermann authored Sep 2, 2024
2 parents a6fe02a + ed7df7d commit 046e5d0
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.TextAlignment;
Expand All @@ -35,6 +36,7 @@ public class MobileRefreshPage extends StackPane {

private final WeakInvalidationListener weakInvalidationListener = new WeakInvalidationListener(invalidationListener);
private final RepositoryUpdater repositoryUpdater = new RepositoryUpdater();
private final CustomImageView logo;

public MobileRefreshPage(ObjectProperty<Size> size) {
getStyleClass().add(DEFAULT_STYLE_CLASS);
Expand All @@ -44,10 +46,19 @@ public MobileRefreshPage(ObjectProperty<Size> size) {
invalidationListener.invalidated(null);
});

// top part (logo)
CustomImageView logo = new CustomImageView();
logo = new CustomImageView();
logo.getStyleClass().addAll("jfx-central-logo", "color");

boolean firstTimeSetup = RepositoryManager.isFirstTimeSetup();

if (firstTimeSetup) {
setupFirstTimeUI();
} else {
setupUpdateUI();
}
}

private void setupFirstTimeUI() {
// center part (intro pane)
IntroPane introPane = new IntroPane();
VBox.setVgrow(introPane, Priority.ALWAYS);
Expand All @@ -72,8 +83,8 @@ public MobileRefreshPage(ObjectProperty<Size> size) {
// bottom part
Button startButton = new Button("Get Started");
startButton.getStyleClass().add("start-button");
startButton.setVisible(RepositoryManager.isFirstTimeSetup());
startButton.setVisible(RepositoryManager.isFirstTimeSetup());
startButton.setVisible(true);
startButton.setVisible(true);
startButton.setOnAction(evt -> {
startButton.setVisible(false);
startButton.setManaged(false);
Expand All @@ -88,10 +99,22 @@ public MobileRefreshPage(ObjectProperty<Size> size) {
VBox content = new VBox(logo, introPane, bottomBox);
content.getStyleClass().add("content-box");
getChildren().add(content);
}

if (!RepositoryManager.isFirstTimeSetup()) {
repositoryUpdater.performUpdate(true);
}
private void setupUpdateUI() {
Label tipsLabel = new Label("Checking for updates ...");

Region dividingLine = new Region();
dividingLine.getStyleClass().add("dividing-line");

VBox updateContentBox = new VBox(logo, dividingLine, tipsLabel);
updateContentBox.getStyleClass().add("update-content-box");
updateContentBox.setMaxHeight(Region.USE_PREF_SIZE);

getChildren().add(updateContentBox);

// start the update process
repositoryUpdater.performUpdate(true);
}

}
22 changes: 22 additions & 0 deletions mobile/src/main/resources/com/dlsc/jfxcentral2/mobile/mobile.css
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,28 @@
-fx-border-width: 0 0 1px 0;
}

.mobile-refresh-page .update-content-box {
-fx-alignment: center;
-fx-padding: 0 50px;
-fx-spacing: 5px;
}

.mobile-refresh-page .update-content-box .custom-image-view {
-fx-fit-width: 400px;
}

.mobile-refresh-page .update-content-box .dividing-line {
-fx-border-color: #75767660;
-fx-border-width: 0 0 1px 0;
-fx-padding: 0 0 10px 0;
}

.mobile-refresh-page .update-content-box > .label {
-fx-font-family: "Roboto Condensed";
-fx-font-size: 1.3em;
-fx-text-fill: -grey-30;
}

/** ----------------------------------
* IntroPane
*/
Expand Down

0 comments on commit 046e5d0

Please sign in to comment.