diff --git a/client/src/main/java/envoy/client/ui/listcell/MessageControl.java b/client/src/main/java/envoy/client/ui/listcell/MessageControl.java index d2a70f8..e3b4e76 100644 --- a/client/src/main/java/envoy/client/ui/listcell/MessageControl.java +++ b/client/src/main/java/envoy/client/ui/listcell/MessageControl.java @@ -15,10 +15,12 @@ import javafx.scene.control.Label; import javafx.scene.control.MenuItem; import javafx.scene.image.Image; import javafx.scene.image.ImageView; +import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import envoy.client.ui.AudioControl; import envoy.client.ui.IconUtil; +import envoy.data.GroupMessage; import envoy.data.Message; import envoy.data.Message.MessageStatus; import envoy.data.User; @@ -51,7 +53,28 @@ public class MessageControl extends Label { */ public MessageControl(Message message) { // Creating the underlying VBox and the dateLabel - final var vbox = new VBox(new Label(dateFormat.format(message.getCreationDate()))); + final var hbox = new HBox(); + if (message.getSenderID() != client.getID() && message instanceof GroupMessage) { + client.getContacts() + .stream() + .filter(c -> c instanceof User) + .filter(c -> c.getID() == message.getSenderID()) + .findFirst() + .ifPresentOrElse(c -> { + Label label = new Label(c.getName() + " "); + label.getStyleClass().add("groupMemberNames"); + hbox.getChildren().add(label); + }, () -> { + Label label = new Label("Unknown User "); + label.getStyleClass().add("groupMemberNames"); + hbox.getChildren().add(label); + }); + // TODO improve offline login (contacts list is empty when logging in offline) + // TODO when contact is added, unknown user has to change immediately to the + // name, not only after relogging + } + hbox.getChildren().add(new Label(dateFormat.format(message.getCreationDate()))); + final var vbox = new VBox(hbox); // Creating the actions for the MenuItems final ContextMenu contextMenu = new ContextMenu(); diff --git a/client/src/main/resources/css/dark.css b/client/src/main/resources/css/dark.css index 21beed5..603b64c 100644 --- a/client/src/main/resources/css/dark.css +++ b/client/src/main/resources/css/dark.css @@ -53,3 +53,8 @@ #messageEnterContainer { -fx-background-color: #363636; } + +.groupMemberNames { + -fx-text-fill: rgb(105.0,0.0,153.0); + -fx-font-weight: bold; +} diff --git a/client/src/main/resources/icons/dark/.user_icon.png-autosave.kra b/client/src/main/resources/icons/dark/.user_icon.png-autosave.kra deleted file mode 100644 index 5fbf2ae..0000000 Binary files a/client/src/main/resources/icons/dark/.user_icon.png-autosave.kra and /dev/null differ