Skip to content
Snippets Groups Projects
Commit c4591e46 authored by Alexis Durgnat's avatar Alexis Durgnat :milky_way:
Browse files

Differentiate other and self chatmessages

parent 3c529dd2
No related branches found
No related tags found
1 merge request!21*poof* final version
......@@ -34,6 +34,7 @@ public final class AppConfig {
* Resources
*/
public static final String CHAT_MESSAGE_ICON = "/img/bubble.png";
public static final String CHAT_MESSAGE_ICON_SELF = "/img/bubble_self.png";
public static final String HELP_MESSAGE_ICON = "/img/help.png";
/**
* Style
......
......@@ -311,8 +311,13 @@ public class MainWindowController implements Initializable {
app.getMessageManager().conditionalSubscribeChatMessage(
chatMessage -> {
Platform.runLater(() -> {
String message = chatMessage.getUser().toString() + ": " + chatMessage.getMessage();
drawMessage(chatMessage.getUser(), message, AppConfig.CHAT_MESSAGE_ICON, AppConfig.COLOR_BLUE_10_OPACITY);
User sender = chatMessage.getUser();
String message = sender.getName() + ": " + chatMessage.getMessage();
if (sender.equals(app.getUser().get())) {
drawMessage(sender, message, AppConfig.CHAT_MESSAGE_ICON_SELF, AppConfig.COLOR_BLUE_10_OPACITY);
} else {
drawMessage(sender, message, AppConfig.CHAT_MESSAGE_ICON, AppConfig.COLOR_BLUE_10_OPACITY);
}
});
},
chatMessage -> !(app.getUser().get().getIgnoredUserList().contains(chatMessage.getUser()))
......
src/main/resources/img/bubble_self.png

15.7 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment