From d1368d43c827f5be6cdf513ac53384f6c0b83842 Mon Sep 17 00:00:00 2001 From: DieGurke <55625494+DieGurke@users.noreply.github.com> Date: Sat, 11 Jul 2020 10:46:17 +0200 Subject: [PATCH] UI isn't shown if there arn't any unread messages --- .../envoy/client/ui/listcell/ChatControl.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/envoy/client/ui/listcell/ChatControl.java b/src/main/java/envoy/client/ui/listcell/ChatControl.java index 444d3e5..68e3548 100644 --- a/src/main/java/envoy/client/ui/listcell/ChatControl.java +++ b/src/main/java/envoy/client/ui/listcell/ChatControl.java @@ -40,16 +40,18 @@ public class ChatControl extends HBox { vBox.getChildren().add(new Label(((Group) contact).getContacts().size() + " members")); getChildren().add(vBox); - Region spacing = new Region(); - setHgrow(spacing, Priority.ALWAYS); - getChildren().add(spacing); - final var unreadMessagesLabel = new Label("" + unreadMessagesAmount); - unreadMessagesLabel.setMinSize(15, 15); - var vBox2 = new VBox(); - vBox2.setAlignment(Pos.CENTER_RIGHT); - unreadMessagesLabel.setAlignment(Pos.CENTER); - unreadMessagesLabel.getStyleClass().add("unreadMessagesAmount"); - vBox2.getChildren().add(unreadMessagesLabel); - getChildren().add(vBox2); + if (unreadMessagesAmount != 0) { + Region spacing = new Region(); + setHgrow(spacing, Priority.ALWAYS); + getChildren().add(spacing); + final var unreadMessagesLabel = new Label("" + unreadMessagesAmount); + unreadMessagesLabel.setMinSize(15, 15); + var vBox2 = new VBox(); + vBox2.setAlignment(Pos.CENTER_RIGHT); + unreadMessagesLabel.setAlignment(Pos.CENTER); + unreadMessagesLabel.getStyleClass().add("unreadMessagesAmount"); + vBox2.getChildren().add(unreadMessagesLabel); + getChildren().add(vBox2); + } } }