Display Current User Status and Unread Message Amount in Status Tray Icon #103

Merged
kske merged 8 commits from f/enhanced-status-tray-icon into develop 2020-10-23 17:19:46 +02:00
Showing only changes of commit 241e5def03 - Show all commits

View File

@ -32,12 +32,12 @@ public final class ChatControl extends HBox {
setPadding(new Insets(0, 0, 3, 0));
// Profile picture
final var contactProfilePic =
var contactProfilePic =
new ProfilePicImageView(chat instanceof GroupChat ? groupIcon : userIcon, 32);
getChildren().add(contactProfilePic);
// Spacing
final var leftSpacing = new Region();
var leftSpacing = new Region();
leftSpacing.setPrefSize(8, 0);
leftSpacing.setMinSize(8, 0);
leftSpacing.setMaxSize(8, 0);
@ -48,17 +48,15 @@ public final class ChatControl extends HBox {
// Unread messages
if (chat.getUnreadAmount() != 0) {
final var spacing = new Region();
var spacing = new Region();
setHgrow(spacing, Priority.ALWAYS);
getChildren().add(spacing);
final var unreadMessagesLabel = new Label(Integer.toString(chat.getUnreadAmount()));
var unreadMessagesLabel = new Label(
chat.getUnreadAmount() > 99 ? "99+" : String.valueOf(chat.getUnreadAmount()));
unreadMessagesLabel.setMinSize(15, 15);
final var vbox = new VBox();
vbox.setAlignment(Pos.CENTER_RIGHT);
unreadMessagesLabel.setAlignment(Pos.CENTER);
unreadMessagesLabel.setAlignment(Pos.CENTER_RIGHT);
unreadMessagesLabel.getStyleClass().add("unread-messages-amount");
vbox.getChildren().add(unreadMessagesLabel);
getChildren().add(vbox);
getChildren().add(unreadMessagesLabel);
}
getStyleClass().add("list-element");
}