From 15d6aa085cd5bc90aa8e3e6af681c6d31d5f9cd0 Mon Sep 17 00:00:00 2001 From: DieGurke <55625494+DieGurke@users.noreply.github.com> Date: Thu, 16 Jul 2020 21:13:46 +0200 Subject: [PATCH] Improved top bar --- .../envoy/client/ui/controller/ChatScene.java | 21 ++++ client/src/main/resources/css/base.css | 6 +- client/src/main/resources/css/dark.css | 2 +- client/src/main/resources/fxml/ChatScene.fxml | 105 ++++++++++++------ 4 files changed, 100 insertions(+), 34 deletions(-) diff --git a/client/src/main/java/envoy/client/ui/controller/ChatScene.java b/client/src/main/java/envoy/client/ui/controller/ChatScene.java index e5c1931..34d424f 100644 --- a/client/src/main/java/envoy/client/ui/controller/ChatScene.java +++ b/client/src/main/java/envoy/client/ui/controller/ChatScene.java @@ -96,6 +96,15 @@ public final class ChatScene implements Restorable { @FXML private ImageView attachmentView; + @FXML + private Label topBarContactLabel; + + @FXML + private Label topBarStatusLabel; + + @FXML + private Button messageSearchButton; + private LocalDB localDB; private Client client; private WriteProxy writeProxy; @@ -132,6 +141,7 @@ public final class ChatScene implements Restorable { attachmentButton.setGraphic(new ImageView(IconUtil.loadIconThemeSensitive("attachment", DEFAULT_ICON_SIZE))); attachmentView.setImage(DEFAULT_ATTACHMENT_VIEW_IMAGE); rotateButton.setGraphic(new ImageView(IconUtil.loadIconThemeSensitive("rotate", (int) (DEFAULT_ICON_SIZE * 1.5)))); + messageSearchButton.setGraphic(new ImageView(IconUtil.loadIconThemeSensitive("search", DEFAULT_ICON_SIZE))); // Listen to received messages eventBus.register(MessageCreationEvent.class, e -> { @@ -268,6 +278,17 @@ public final class ChatScene implements Restorable { voiceButton.setDisable(!recorder.isSupported()); attachmentButton.setDisable(false); chatList.refresh(); + + topBarContactLabel.setText(currentChat.getRecipient().getName()); + if (currentChat.getRecipient() instanceof User) { + String status = ((User) currentChat.getRecipient()).getStatus().toString(); + topBarStatusLabel.setText(status); + topBarStatusLabel.getStyleClass().add(status.toLowerCase()); + } + else topBarStatusLabel.setText(currentChat.getRecipient().getContacts().size() + " members"); + + if (currentChat != null) + messageSearchButton.setVisible(true); } /** diff --git a/client/src/main/resources/css/base.css b/client/src/main/resources/css/base.css index 5c1027d..cbfd244 100644 --- a/client/src/main/resources/css/base.css +++ b/client/src/main/resources/css/base.css @@ -12,7 +12,7 @@ -fx-background-radius: 5em; } -#bottomButton { +#roundButton { -fx-background-radius: 5em; } @@ -123,3 +123,7 @@ #infoLabel-error { -fx-text-fill: red; } + +#transparentBackground { + -fx-background-color: transparent; +} diff --git a/client/src/main/resources/css/dark.css b/client/src/main/resources/css/dark.css index 7cbc145..0db8841 100644 --- a/client/src/main/resources/css/dark.css +++ b/client/src/main/resources/css/dark.css @@ -46,7 +46,7 @@ -fx-background-color: rgb(25, 25, 25); } -#chatList { +#chatList, #topBar { -fx-background-color: #303030; } diff --git a/client/src/main/resources/fxml/ChatScene.fxml b/client/src/main/resources/fxml/ChatScene.fxml index 29d9f08..068927a 100644 --- a/client/src/main/resources/fxml/ChatScene.fxml +++ b/client/src/main/resources/fxml/ChatScene.fxml @@ -14,7 +14,10 @@ + + + @@ -22,15 +25,15 @@ - - + + - + @@ -43,28 +46,51 @@ - - + + + + + + + + + + + + + + + + + + + + + - + @@ -83,7 +109,7 @@ - - - -