diff --git a/app/build.gradle b/app/build.gradle index 916679591..4166b9e54 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -157,7 +157,7 @@ dependencies { implementation 'com.github.wooplr:Spotlight:1.2.3' - implementation 'com.github.mario:ChatKit:ed2e3cf370' + implementation 'com.github.mario:ChatKit:40a8e9cf69' implementation 'com.otaliastudios:autocomplete:1.1.0' diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java index cb2be32f1..1b165dba2 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java @@ -744,16 +744,44 @@ public class ChatController extends BaseController implements MessagesListAdapte if (emptyLayout != null) { emptyLayout.setVisibility(View.VISIBLE); } - } else { + if (messagesListView != null) { - messagesListView.setVisibility(View.VISIBLE); + messagesListView.setVisibility(View.GONE); + } + + } else { + boolean foundRealMessage = false; + for (int i = 0; i < chatMessageList.size(); i++) { + if (TextUtils.isEmpty(chatMessageList.get(i).getSystemMessage())) { + foundRealMessage = true; + break; + } + } + + if (foundRealMessage) { + if (emptyLayout != null) { + emptyLayout.setVisibility(View.GONE); + } + + if (messagesListView != null) { + messagesListView.setVisibility(View.VISIBLE); + } + } else { + if (emptyLayout != null && emptyLayout.getVisibility() != View.VISIBLE) { + emptyLayout.setVisibility(View.VISIBLE); + } + + if (messagesListView != null && messagesListView.getVisibility() != View.GONE) { + messagesListView.setVisibility(View.GONE); + } } } } else { - if (emptyLayout.getVisibility() != View.GONE) { + if (emptyLayout != null) { emptyLayout.setVisibility(View.GONE); } - if (messagesListView.getVisibility() != View.VISIBLE) { + + if (messagesListView != null) { messagesListView.setVisibility(View.VISIBLE); } } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java index 15526ddb6..08371dbfc 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java +++ b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java @@ -130,4 +130,9 @@ public class ChatMessage implements IMessage, MessageContentType { public Date getCreatedAt() { return new Date(timestamp * 1000L); } + + @Override + public String getSystemMessage() { + return new EnumSystemMessageTypeConverter().convertToString(getSystemMessageType()); + } }