Skip to content

Commit

Permalink
Merge pull request #666 from dlsc-software-consulting-gmbh/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
dlemmermann committed Sep 5, 2024
2 parents 66092c6 + 37daa80 commit 0553769
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private MobileRouter createMobileRouter() {
return MobileResponse.redirect(r, PagePath.REFRESH);
}
}))
.and(MobileRoute.get(PagePath.REFRESH, r -> MobileResponse.view(r, new MobileRefreshPage(size))))
.and(MobileRoute.get(PagePath.REFRESH, r -> MobileResponse.view(r, new MobileRefreshPage())))
.and(MobileRoute.redirect("/index", PagePath.HOME))
.and(MobileRoute.redirect("/home", PagePath.HOME))
.and(MobileRoute.get(PagePath.LINKS, r -> MobileResponse.view(r, new MobileLinksOfTheWeekPage(size))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,20 @@ public class MobileRefreshPage extends StackPane {
*/
private final InvalidationListener invalidationListener = it -> {
if (RepositoryManager.isRepositoryUpdated()) {
Platform.runLater(() -> MobileLinkUtil.getToPage(PagePath.HOME));
Platform.runLater(() -> {
if (isGoToHomePage()) {
MobileLinkUtil.getToPage(PagePath.HOME);
}
});
}
};

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

public MobileRefreshPage(ObjectProperty<Size> size) {
public MobileRefreshPage() {
getStyleClass().add(DEFAULT_STYLE_CLASS);

Platform.runLater(() -> {
Expand All @@ -63,10 +68,15 @@ public MobileRefreshPage(ObjectProperty<Size> size) {
if (firstTimeSetup) {
setupFirstTimeUI();
} else {
goToHomePage = true;
setupUpdateUI();
}
}

private boolean isGoToHomePage() {
return goToHomePage;
}

private void setupFirstTimeUI() {
// center part (intro pane)
IntroPane introPane = new IntroPane();
Expand Down Expand Up @@ -98,7 +108,6 @@ private void setupFirstTimeUI() {

FadeIn fadeIn = new FadeIn(loadLabel);
fadeIn.setSpeed(2);
fadeIn.setOnFinished(e -> repositoryUpdater.performUpdate(false));

fadeOut.setOnFinished(e -> {
startButton.setVisible(false);
Expand All @@ -107,6 +116,14 @@ private void setupFirstTimeUI() {
});

fadeOut.play();

goToHomePage = true;

if (RepositoryManager.isRepositoryUpdated()) {
Platform.runLater(() -> {
MobileLinkUtil.getToPage(PagePath.HOME);
});
}
});

StackPane bottomBox = new StackPane(startButton, loadLabel);
Expand All @@ -115,6 +132,8 @@ private void setupFirstTimeUI() {
VBox content = new VBox(logo, introPane, bottomBox);
content.getStyleClass().add("content-box");
getChildren().add(content);

repositoryUpdater.performUpdate(false);
}

private void setupUpdateUI() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1034,12 +1034,12 @@

.mobile-refresh-page > .content-box {
-fx-alignment: top-center;
-fx-padding: 80px 0 40px 0;
-fx-padding: 90px 0 40px 0;
-fx-spacing: 20px;
}

.mobile-refresh-page > .content-box > .custom-image-view {
-fx-fit-height: 40px;
-fx-fit-height: 50px;
}

.mobile-refresh-page .bottom-box {
Expand Down Expand Up @@ -1077,6 +1077,7 @@
}

.mobile-refresh-page .bottom-box .load-label {
-fx-font-family: monospace;
-fx-font-size: 1.2em;
-fx-text-fill: -grey-60;
-fx-text-alignment: center;
Expand Down

0 comments on commit 0553769

Please sign in to comment.