diff --git a/src/main/java/org/cryptomator/ui/notification/NotificationController.java b/src/main/java/org/cryptomator/ui/notification/NotificationController.java index 9e60ceaa7..72c940d9e 100644 --- a/src/main/java/org/cryptomator/ui/notification/NotificationController.java +++ b/src/main/java/org/cryptomator/ui/notification/NotificationController.java @@ -1,11 +1,12 @@ package org.cryptomator.ui.notification; +import org.cryptomator.cryptofs.event.BrokenDirFileEvent; import org.cryptomator.cryptofs.event.FilesystemEvent; import org.cryptomator.ui.common.FxController; import org.cryptomator.ui.fxapp.FxNotificationRadar; import javax.inject.Inject; -import javafx.beans.binding.BooleanBinding; +import javafx.beans.binding.Bindings; import javafx.beans.property.IntegerProperty; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleIntegerProperty; @@ -15,6 +16,7 @@ import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.beans.value.ObservableBooleanValue; import javafx.beans.value.ObservableIntegerValue; +import javafx.beans.value.ObservableStringValue; import javafx.beans.value.ObservableValue; import javafx.fxml.FXML; import javafx.stage.Stage; @@ -30,6 +32,7 @@ public class NotificationController implements FxController { private final Stage window; private final SimpleListProperty notificationsProp; private final IntegerProperty selectionIndex; + private final ObservableStringValue paging; private final ObjectProperty selectedEvent; private final StringProperty message; private final StringProperty description; @@ -42,8 +45,9 @@ public class NotificationController implements FxController { this.notificationsProp = new SimpleListProperty<>(notificationRadar.getEventsRequiringNotification()); this.selectionIndex = new SimpleIntegerProperty(0); this.selectedEvent = new SimpleObjectProperty<>(); - selectionIndex.addListener((obs, o, n) -> selectedEvent.setValue(notificationsProp.get(n.intValue()))); + selectionIndex.addListener((_, _, n) -> selectedEvent.setValue(notificationsProp.get(n.intValue()))); selectedEvent.addListener(this::adjustTexts); + this.paging = Bindings.createStringBinding(() -> selectionIndex.get() + 1 + "/" + notificationsProp.size(), selectionIndex, notificationsProp); this.message = new SimpleStringProperty(); this.description = new SimpleStringProperty(); this.actionText = new SimpleStringProperty(); @@ -87,6 +91,20 @@ public class NotificationController implements FxController { } } + @FXML void previousNotification() { + int i = selectionIndex.get(); + if( i != 0) { + selectionIndex.set(i-1); + } + } + + @FXML void nextNotification() { + int i = selectionIndex.get(); + if(i != notificationsProp.size() - 1){ + selectionIndex.set(i+1); + } + } + @FXML public void close() { notificationsProp.clear(); @@ -127,20 +145,12 @@ public class NotificationController implements FxController { return actionText.get() != null; } - public ObservableIntegerValue selectionIndexProperty() { - return selectionIndex; + public ObservableStringValue pagingProperty() { + return paging; } - public int getSelectionIndex() { - return selectionIndex.get(); - } - - public ObservableIntegerValue numberOfNotificationsProperty() { - return notificationsProp.sizeProperty(); - } - - public int getNumberOfNotifications() { - return notificationsProp.size(); + public String getPaging() { + return paging.get(); } } diff --git a/src/main/resources/css/light_theme.css b/src/main/resources/css/light_theme.css index 68d6dda03..9bdea8e0a 100644 --- a/src/main/resources/css/light_theme.css +++ b/src/main/resources/css/light_theme.css @@ -1187,16 +1187,17 @@ -fx-font-size: 1.166667em; /* 14pt - 2 more than the default font */ } -/** - Notification Window -**/ +/******************************************************************************* + * * + * Notification Window + * * + ******************************************************************************/ .notification-window { -fx-background-color: MAIN_BG; - -fx-background-radius: 22; - -fx-border-radius: 22; + -fx-background-radius: 8px; + -fx-border-radius: 8px; -fx-background-insets: 0; - -fx-background-color: rgba(255, 255, 255, 0.92); - -fx-border-color: rgba(0, 0, 0, 0.1); + -fx-border-color: MUTED_BG; -fx-border-width: 1px; -fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.2), 28, 0.35, 0, 6); } @@ -1205,11 +1206,6 @@ -fx-alignment: center-left; } -.notification-window .brand-title { - -fx-font-family: 'Open Sans SemiBold'; - -fx-font-size: 18px; -} - .notification-window .close-button { -fx-background-color: transparent; -fx-border-color: transparent; @@ -1225,30 +1221,6 @@ -fx-background-color: CONTROL_BG_ARMED; } -.notification-window .notification-title { - -fx-font-family: 'Open Sans Bold'; - -fx-font-size: 28px; - -fx-text-fill: TEXT_FILL; -} - -.notification-window .notification-description { - -fx-font-size: 20px; - -fx-text-fill: TEXT_FILL; - -fx-line-spacing: 6px; -} - -.notification-window .action-button { - -fx-background-color: CONTROL_BG_NORMAL; - -fx-border-color: CONTROL_BORDER_NORMAL; - -fx-border-width: 2px; - -fx-background-radius: 12; - -fx-border-radius: 12; - -fx-font-family: 'Open Sans SemiBold'; - -fx-font-size: 22px; - -fx-text-fill: TEXT_FILL; - -fx-padding: 10 28 12 28; -} - .notification-window .action-button:hover { -fx-background-color: CONTROL_BG_HOVER; -fx-border-color: CONTROL_BORDER_FOCUSED; @@ -1271,9 +1243,4 @@ .notification-window .nav-button:pressed { -fx-background-color: CONTROL_BG_ARMED; -} - -.notification-window .page-indicator { - -fx-font-size: 14px; - -fx-text-fill: TEXT_FILL; -} +} \ No newline at end of file diff --git a/src/main/resources/fxml/notification.fxml b/src/main/resources/fxml/notification.fxml index fed6005aa..ab82b5755 100644 --- a/src/main/resources/fxml/notification.fxml +++ b/src/main/resources/fxml/notification.fxml @@ -6,29 +6,28 @@ + - - - + - @@ -36,31 +35,27 @@
-
- + - - - + +