properly trigger show load more messages in mucs

This commit is contained in:
Daniel Gultsch 2016-02-22 20:28:58 +01:00
parent a0d0ed34ae
commit 689ded1607
1 changed files with 10 additions and 2 deletions

View File

@ -1083,12 +1083,20 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
private boolean showLoadMoreMessages(final Conversation c) {
final XmppConnection connection = c.getAccount().getXmppConnection();
final boolean mam = connection != null && connection.getFeatures().mam();
final boolean mam = hasMamSupport(c);
final MessageArchiveService service = activity.xmppConnectionService.getMessageArchiveService();
return mam && (c.getLastClearHistory() != 0 || (c.countMessages() == 0 && c.hasMessagesLeftOnServer() && !service.queryInProgress(c)));
}
private boolean hasMamSupport(final Conversation c) {
if (c.getMode() == Conversation.MODE_SINGLE) {
final XmppConnection connection = c.getAccount().getXmppConnection();
return connection != null && connection.getFeatures().mam();
} else {
return c.getMucOptions().mamSupport();
}
}
protected void showSnackbar(final int message, final int action, final OnClickListener clickListener) {
snackbar.setVisibility(View.VISIBLE);
snackbar.setOnClickListener(null);