Implemented ProfilePics UI mechanism

This commit is contained in:
DieGurke
2020-07-17 13:56:36 +02:00
parent 62d9df7ae8
commit b4225b0d80
6 changed files with 97 additions and 35 deletions

View File

@ -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);
}
}
/**