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 469c39a..c57d736 100644
--- a/client/src/main/java/envoy/client/ui/controller/ChatScene.java
+++ b/client/src/main/java/envoy/client/ui/controller/ChatScene.java
@@ -23,6 +23,7 @@ import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.GridPane;
import javafx.scene.paint.Color;
+import javafx.scene.shape.Rectangle;
import javafx.stage.FileChooser;
import javafx.util.Duration;
@@ -103,6 +104,12 @@ public final class ChatScene implements Restorable {
@FXML
private Button messageSearchButton;
+ @FXML
+ private ImageView clientProfilePic;
+
+ @FXML
+ private ImageView recipientProfilePic;
+
private LocalDB localDB;
private Client client;
private WriteProxy writeProxy;
@@ -140,6 +147,13 @@ public final class ChatScene implements Restorable {
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)));
+ clientProfilePic.setImage(IconUtil.loadIconThemeSensitive("user_icon", 43));
+ Rectangle clip = new Rectangle();
+ clip.setWidth(43);
+ clip.setHeight(43);
+ clip.setArcHeight(43);
+ clip.setArcWidth(43);
+ clientProfilePic.setClip(clip);
// Listen to received messages
eventBus.register(MessageCreationEvent.class, e -> {
@@ -278,16 +292,26 @@ public final class ChatScene implements Restorable {
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);
+ if (currentChat != null) {
+ 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());
+ recipientProfilePic.setImage(IconUtil.loadIconThemeSensitive("user_icon", 43));
+ } else {
+ topBarStatusLabel.setText(currentChat.getRecipient().getContacts().size() + " members");
+ recipientProfilePic.setImage(IconUtil.loadIconThemeSensitive("group_icon", 43));
+ }
+ Rectangle clip = new Rectangle();
+ clip.setWidth(43);
+ clip.setHeight(43);
+ clip.setArcHeight(43);
+ clip.setArcWidth(43);
+ recipientProfilePic.setClip(clip);
+
+ messageSearchButton.setVisible(true);
+ }
}
/**
diff --git a/client/src/main/java/envoy/client/ui/listcell/ChatControl.java b/client/src/main/java/envoy/client/ui/listcell/ChatControl.java
index a0bd640..39086ca 100644
--- a/client/src/main/java/envoy/client/ui/listcell/ChatControl.java
+++ b/client/src/main/java/envoy/client/ui/listcell/ChatControl.java
@@ -1,10 +1,15 @@
package envoy.client.ui.listcell;
+import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
+import javafx.scene.image.ImageView;
import javafx.scene.layout.*;
+import javafx.scene.shape.Rectangle;
import envoy.client.data.Chat;
+import envoy.client.ui.IconUtil;
+import envoy.data.Group;
/**
* Displays a chat using a contact control for the recipient and a label for the
@@ -25,7 +30,25 @@ public class ChatControl extends HBox {
* @since Envoy Client v0.1-beta
*/
public ChatControl(Chat chat) {
-
+ setAlignment(Pos.CENTER_LEFT);
+ setPadding(new Insets(0, 0, 3, 0));
+ // profile pic
+ ImageView contactProfilePic;
+ if (chat.getRecipient() instanceof Group) contactProfilePic = new ImageView(IconUtil.loadIconThemeSensitive("group_icon", 32));
+ else contactProfilePic = new ImageView(IconUtil.loadIconThemeSensitive("user_icon", 32));
+ Rectangle clip = new Rectangle();
+ clip.setWidth(32);
+ clip.setHeight(32);
+ clip.setArcHeight(32);
+ clip.setArcWidth(32);
+ contactProfilePic.setClip(clip);
+ getChildren().add(contactProfilePic);
+ // spacing
+ Region leftSpacing = new Region();
+ leftSpacing.setPrefSize(8, 0);
+ leftSpacing.setMinSize(8, 0);
+ leftSpacing.setMaxSize(8, 0);
+ getChildren().add(leftSpacing);
// Contact control
getChildren().add(new ContactControl(chat.getRecipient()));
// Unread messages
diff --git a/client/src/main/resources/css/base.css b/client/src/main/resources/css/base.css
index cbfd244..3549824 100644
--- a/client/src/main/resources/css/base.css
+++ b/client/src/main/resources/css/base.css
@@ -127,3 +127,7 @@
#transparentBackground {
-fx-background-color: transparent;
}
+
+#profilePic {
+ -fx-radius: 1em;
+}
diff --git a/client/src/main/resources/fxml/ChatScene.fxml b/client/src/main/resources/fxml/ChatScene.fxml
index 9cd5d1f..8541cc2 100644
--- a/client/src/main/resources/fxml/ChatScene.fxml
+++ b/client/src/main/resources/fxml/ChatScene.fxml
@@ -48,6 +48,11 @@
+
+
+
+
+
@@ -143,31 +151,29 @@
-
+
-
-
+
+
+
+
+
+
@@ -178,6 +184,11 @@
+
+
+
+
+
-
+
diff --git a/client/src/main/resources/icons/dark/group_icon.png b/client/src/main/resources/icons/dark/group_icon.png
new file mode 100644
index 0000000..5b1660e
Binary files /dev/null and b/client/src/main/resources/icons/dark/group_icon.png differ
diff --git a/client/src/main/resources/icons/dark/user_icon.png b/client/src/main/resources/icons/dark/user_icon.png
new file mode 100644
index 0000000..b44604c
Binary files /dev/null and b/client/src/main/resources/icons/dark/user_icon.png differ