Fix Incorrect ChatScene Size on Startup #79

Merged
delvh merged 2 commits from b/incorrect-chatscene-size into develop 2020-10-05 18:50:46 +02:00
2 changed files with 14 additions and 10 deletions
Showing only changes of commit 8383bed10b - Show all commits

View File

@ -223,16 +223,16 @@ public final class ChatScene implements EventListener, Restorable {
final var recipientID = message instanceof GroupMessage || ownMessage ? message.getRecipientID() : message.getSenderID(); final var recipientID = message instanceof GroupMessage || ownMessage ? message.getRecipientID() : message.getSenderID();
localDB.getChat(recipientID).ifPresent(chat -> { localDB.getChat(recipientID).ifPresent(chat -> {
chat.insert(message);
// Read current chat or increment unread amount
if (chat.equals(currentChat)) {
currentChat.read(writeProxy);
Platform.runLater(this::scrollToMessageListEnd);
} else if (!ownMessage && message.getStatus() != MessageStatus.READ) chat.incrementUnreadAmount();
// Move chat with most recent unread messages to the top
Platform.runLater(() -> { Platform.runLater(() -> {
chat.insert(message);
// Read current chat or increment unread amount
if (chat.equals(currentChat)) {
currentChat.read(writeProxy);
scrollToMessageListEnd();
} else if (!ownMessage && message.getStatus() != MessageStatus.READ) chat.incrementUnreadAmount();
// Move chat with most recent unread messages to the top
chats.getSource().remove(chat); chats.getSource().remove(chat);
((ObservableList<Chat>) chats.getSource()).add(0, chat); ((ObservableList<Chat>) chats.getSource()).add(0, chat);

View File

@ -20,13 +20,17 @@
<?import javafx.scene.layout.RowConstraints?> <?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<?import javafx.stage.Screen?>
<GridPane fx:id="scene" maxHeight="-Infinity" <GridPane fx:id="scene" maxHeight="-Infinity"
maxWidth="-Infinity" minHeight="400.0" minWidth="500.0" maxWidth="-Infinity" minHeight="400.0" minWidth="500.0"
prefHeight="1152.0" prefWidth="2042.0" prefHeight="${screen.visualBounds.height}" prefWidth="${screen.visualBounds.width}"
xmlns="http://javafx.com/javafx/11.0.1" xmlns="http://javafx.com/javafx/11.0.1"
xmlns:fx="http://javafx.com/fxml/1" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="envoy.client.ui.controller.ChatScene"> fx:controller="envoy.client.ui.controller.ChatScene">
<fx:define>
<Screen fx:factory="getPrimary" fx:id="screen" />
</fx:define>
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="NEVER" <ColumnConstraints hgrow="NEVER"
maxWidth="327.99997965494794" minWidth="-Infinity" prefWidth="317.0" /> maxWidth="327.99997965494794" minWidth="-Infinity" prefWidth="317.0" />