Redesign notifcation dialog

* add Cryptomator title
* include vault name in message
* remove bottom section and move button to current message area
This commit is contained in:
Armin Schrenk
2025-12-10 13:01:07 +01:00
parent f4b56e5e51
commit 5a0145800d
3 changed files with 51 additions and 32 deletions

View File

@@ -31,6 +31,7 @@ public class NotificationController implements FxController {
private final IntegerProperty selectionIndex;
private final ObservableStringValue paging;
private final ObjectProperty<VaultEvent> selectedEvent;
private final StringProperty vaultName;
private final StringProperty message;
private final StringProperty description;
private final StringProperty actionText;
@@ -43,6 +44,7 @@ public class NotificationController implements FxController {
this.selectionIndex = new SimpleIntegerProperty(-1);
this.selectedEvent = new SimpleObjectProperty<>();
this.paging = Bindings.createStringBinding(() -> selectionIndex.get() + 1 + "/" + events.size(), selectionIndex, events);
this.vaultName = new SimpleStringProperty();
this.message = new SimpleStringProperty();
this.description = new SimpleStringProperty();
this.actionText = new SimpleStringProperty();
@@ -64,6 +66,7 @@ public class NotificationController implements FxController {
//TODO: Translations!
private void selectTexts(ObservableValue<? extends VaultEvent> observable, VaultEvent oldEvent, VaultEvent newEvent) {
if (newEvent == null) {
vaultName.set("");
message.set("NO CONTENT");
description.set(BUG_MSG);
actionText.set(null);
@@ -72,6 +75,7 @@ public class NotificationController implements FxController {
switch (newEvent.actualEvent()) {
default -> {
vaultName.set(newEvent.v().getDisplayName());
message.set("NO CONTENT");
description.set(BUG_MSG);
actionText.set(null);
@@ -130,6 +134,13 @@ public class NotificationController implements FxController {
//FXML bindings
public ObservableValue<String> vaultNameProperty() {
return vaultName;
}
public String getVaultName() {
return vaultName.get();
}
public ObservableValue<String> messageProperty() {
return message;
}

View File

@@ -113,6 +113,11 @@
-fx-font-size: 1.2em;
}
.label-window-title {
-fx-font-family: 'Open Sans SemiBold';
-fx-font-size: 1.0em;
}
.label-small {
-fx-font-size: 0.8em;
}

View File

@@ -3,6 +3,7 @@
<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Separator?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
@@ -19,42 +20,44 @@
<Insets top="12" right="12" bottom="12" left="12"/>
</padding>
<top>
<HBox spacing="12" styleClass="dialog-header" alignment="CENTER_LEFT">
<ImageView fitHeight="16" preserveRatio="true" cache="true">
<Image url="@../img/logo64.png"/>
</ImageView>
<Label text="${controller.message}" styleClass="label-large"/>
<Region HBox.hgrow="ALWAYS"/>
<Button contentDisplay="GRAPHIC_ONLY" onAction="#close" styleClass="close-button">
<graphic>
<FontAwesome5IconView glyph="TIMES" glyphSize="12"/>
</graphic>
</Button>
</HBox>
<VBox >
<HBox spacing="6" styleClass="dialog-header" alignment="CENTER_LEFT">
<ImageView fitHeight="12" preserveRatio="true" cache="true">
<Image url="@../img/logo64.png"/>
</ImageView>
<Label text="Cryptomator" styleClass="label-window-title"/>
<Region HBox.hgrow="ALWAYS"/>
<Button contentDisplay="GRAPHIC_ONLY" styleClass="nav-button" onAction="#previousNotification">
<graphic>
<FontAwesome5IconView glyph="CHEVRON_LEFT" glyphSize="12"/>
</graphic>
</Button>
<Label text="${controller.paging}" styleClass="label"/>
<Button contentDisplay="GRAPHIC_ONLY" styleClass="nav-button" onAction="#nextNotification">
<graphic>
<FontAwesome5IconView glyph="CHEVRON_RIGHT" glyphSize="12"/>
</graphic>
</Button>
<Button contentDisplay="GRAPHIC_ONLY" onAction="#close" styleClass="close-button">
<graphic>
<FontAwesome5IconView glyph="TIMES" glyphSize="12"/>
</graphic>
</Button>
</HBox>
<Separator orientation="HORIZONTAL"/>
</VBox>
</top>
<center>
<VBox spacing="12">
<VBox>
<padding>
<Insets top="6"/>
</padding>
<Label text="${controller.message}" styleClass="label-large" wrapText="true"/>
<Label text="${controller.vaultName}" styleClass="label-small" wrapText="true"/>
<Label text="${controller.description}" styleClass="label" wrapText="true"/>
</VBox>
</center>
<bottom>
<HBox spacing="6" alignment="CENTER_LEFT">
<Button text="${controller.actionText}" onAction="#processSelectedEvent"
visible="${!controller.actionText.empty}" managed="${!controller.actionText.empty}"/>
<Region HBox.hgrow="ALWAYS"/>
<Button contentDisplay="GRAPHIC_ONLY" styleClass="nav-button" onAction="#previousNotification">
<graphic>
<FontAwesome5IconView glyph="CHEVRON_LEFT" glyphSize="12"/>
</graphic>
</Button>
<Label text="${controller.paging}" styleClass="label"/>
<Button contentDisplay="GRAPHIC_ONLY" styleClass="nav-button" onAction="#nextNotification">
<graphic>
<FontAwesome5IconView glyph="CHEVRON_RIGHT" glyphSize="12"/>
</graphic>
</Button>
</HBox>
</bottom>
</VBox>
</center>
</BorderPane>