diff --git a/src/main/java/envoy/client/ui/controller/ChatScene.java b/src/main/java/envoy/client/ui/controller/ChatScene.java index 26f15df..bb457d4 100644 --- a/src/main/java/envoy/client/ui/controller/ChatScene.java +++ b/src/main/java/envoy/client/ui/controller/ChatScene.java @@ -79,6 +79,9 @@ public final class ChatScene implements Restorable { @FXML private MenuItem deleteContactMenuItem; + @FXML + private ImageView attachmentView; + private LocalDB localDB; private Client client; private WriteProxy writeProxy; @@ -264,9 +267,15 @@ public final class ChatScene implements Restorable { } else { pendingAttachment = new Attachment(recorder.finish(), AttachmentType.VOICE); recording = false; - Platform.runLater(() -> { voiceButton.setText("Record Voice Message"); checkPostConditions(false); }); + Platform.runLater(() -> { + voiceButton.setText("Record Voice Message"); + checkPostConditions(false); + attachmentView.setImage(IconUtil.load(settings.getCurrentTheme().equals("dark") ? "/icons/attachment_present_white.png" + : "/icons/attachment_present_black.png", 20)); + attachmentView.setVisible(true); + }); } - } catch (EnvoyException e) { + } catch (final EnvoyException e) { logger.log(Level.SEVERE, "Could not record audio: ", e); Platform.runLater(new Alert(AlertType.ERROR, "Could not record audio")::showAndWait); } @@ -359,12 +368,13 @@ public final class ChatScene implements Restorable { final var text = messageTextArea.getText().strip(); try { // Create and send message - var builder = new MessageBuilder(localDB.getUser().getID(), currentChat.getRecipient().getID(), localDB.getIDGenerator()).setText(text); + final var builder = new MessageBuilder(localDB.getUser().getID(), currentChat.getRecipient().getID(), localDB.getIDGenerator()) + .setText(text); if (pendingAttachment != null) { builder.setAttachment(pendingAttachment); pendingAttachment = null; } - var message = builder.build(); + final var message = builder.build(); // Send message writeProxy.writeMessage(message); diff --git a/src/main/resources/css/dark.css b/src/main/resources/css/dark.css index 967732b..eaad3a9 100644 --- a/src/main/resources/css/dark.css +++ b/src/main/resources/css/dark.css @@ -11,7 +11,7 @@ } .button:pressed { - -fx-background-color: darkgray; + -fx-background-color: darkviolet; } .button:disabled { diff --git a/src/main/resources/fxml/ChatScene.fxml b/src/main/resources/fxml/ChatScene.fxml index 3239307..76f77a0 100644 --- a/src/main/resources/fxml/ChatScene.fxml +++ b/src/main/resources/fxml/ChatScene.fxml @@ -1,6 +1,7 @@ + @@ -9,6 +10,7 @@ + @@ -23,6 +25,9 @@ prefWidth="160.0" /> + - + @@ -68,8 +73,8 @@ + + + + + + + + diff --git a/src/main/resources/icons/attachment_black.png b/src/main/resources/icons/attachment_black.png new file mode 100644 index 0000000..873803d Binary files /dev/null and b/src/main/resources/icons/attachment_black.png differ diff --git a/src/main/resources/icons/attachment_present_black.png b/src/main/resources/icons/attachment_present_black.png new file mode 100644 index 0000000..bb94b9a Binary files /dev/null and b/src/main/resources/icons/attachment_present_black.png differ diff --git a/src/main/resources/icons/attachment_present_white.png b/src/main/resources/icons/attachment_present_white.png new file mode 100644 index 0000000..65a093d Binary files /dev/null and b/src/main/resources/icons/attachment_present_white.png differ diff --git a/src/main/resources/icons/attachment_white.png b/src/main/resources/icons/attachment_white.png new file mode 100644 index 0000000..1a04f07 Binary files /dev/null and b/src/main/resources/icons/attachment_white.png differ