UI isn't shown if there arn't any unread messages

This commit is contained in:
DieGurke 2020-07-11 10:46:17 +02:00
parent d675349c71
commit faea75dcb1

View File

@ -40,16 +40,18 @@ public class ChatControl extends HBox {
vBox.getChildren().add(new Label(((Group) contact).getContacts().size() + " members")); vBox.getChildren().add(new Label(((Group) contact).getContacts().size() + " members"));
getChildren().add(vBox); getChildren().add(vBox);
Region spacing = new Region(); if (unreadMessagesAmount != 0) {
setHgrow(spacing, Priority.ALWAYS); Region spacing = new Region();
getChildren().add(spacing); setHgrow(spacing, Priority.ALWAYS);
final var unreadMessagesLabel = new Label("" + unreadMessagesAmount); getChildren().add(spacing);
unreadMessagesLabel.setMinSize(15, 15); final var unreadMessagesLabel = new Label("" + unreadMessagesAmount);
var vBox2 = new VBox(); unreadMessagesLabel.setMinSize(15, 15);
vBox2.setAlignment(Pos.CENTER_RIGHT); var vBox2 = new VBox();
unreadMessagesLabel.setAlignment(Pos.CENTER); vBox2.setAlignment(Pos.CENTER_RIGHT);
unreadMessagesLabel.getStyleClass().add("unreadMessagesAmount"); unreadMessagesLabel.setAlignment(Pos.CENTER);
vBox2.getChildren().add(unreadMessagesLabel); unreadMessagesLabel.getStyleClass().add("unreadMessagesAmount");
getChildren().add(vBox2); vBox2.getChildren().add(unreadMessagesLabel);
getChildren().add(vBox2);
}
} }
} }