From 8ccb2005b325d1d26d74c682574008553b6879ad Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 14 Feb 2016 23:53:17 +0100 Subject: [PATCH] only show load more messages button when mam is available also update ui after that button has been pressed. fixes #1695 --- .../eu/siacs/conversations/ui/ConversationActivity.java | 1 + .../eu/siacs/conversations/ui/ConversationFragment.java | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 97774650..5ec2dc97 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -1606,6 +1606,7 @@ public class ConversationActivity extends XmppActivity public void setMessagesLoaded() { if (mConversationFragment != null) { mConversationFragment.setMessagesLoaded(); + mConversationFragment.updateMessages(); } } } diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 5874adae..c555ead0 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -62,6 +62,7 @@ import eu.siacs.conversations.ui.adapter.MessageAdapter.OnContactPictureClicked; import eu.siacs.conversations.ui.adapter.MessageAdapter.OnContactPictureLongClicked; import eu.siacs.conversations.utils.GeoHelper; import eu.siacs.conversations.utils.UIHelper; +import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.chatstate.ChatState; import eu.siacs.conversations.xmpp.jid.Jid; @@ -1014,7 +1015,10 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa protected void updateStatusMessages() { synchronized (this.messageList) { - if (conversation.getLastClearHistory() != 0) { + final XmppConnection connection = conversation.getAccount().getXmppConnection(); + if (conversation.getLastClearHistory() != 0 + && connection != null + && connection.getFeatures().mam()) { this.messageList.add(0, Message.createLoadMoreMessage(conversation)); } if (conversation.getMode() == Conversation.MODE_SINGLE) {