diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-05-31 21:14:40 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-05-31 21:14:40 +0200 |
commit | 83f25dc67e76fedf2729bd09c09406c0597792f6 (patch) | |
tree | 5d290344150be573a477969797c4fdfefaeb945d /src/main/java/de | |
parent | a63146118140e6d2cad0d35ce00a105b8dfe72c0 (diff) |
do not turn send button green unless history is caught up
Diffstat (limited to 'src/main/java/de')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/MessageArchiveService.java | 16 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 7 |
2 files changed, 20 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/services/MessageArchiveService.java b/src/main/java/de/pixart/messenger/services/MessageArchiveService.java index e90bb8d07..b5ee9ac52 100644 --- a/src/main/java/de/pixart/messenger/services/MessageArchiveService.java +++ b/src/main/java/de/pixart/messenger/services/MessageArchiveService.java @@ -101,6 +101,22 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { } } + public boolean isCatchingUp(Conversation conversation) { + final Account account = conversation.getAccount(); + if (account.getXmppConnection().isWaitingForSmCatchup()) { + return true; + } else { + synchronized (this.queries) { + for (Query query : this.queries) { + if (query.getAccount() == account && query.isCatchup() && ((conversation.getMode() == Conversation.MODE_SINGLE && query.getWith() == null) || query.getConversation() == conversation)) { + return true; + } + } + } + return false; + } + } + public Query query(final Conversation conversation, long end, boolean allowCatchup) { return this.query(conversation, conversation.getLastMessageTransmitted(), end, allowCatchup); } diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 084c27a99..bfdcd41f1 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -1307,9 +1307,10 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa action = SendButtonAction.TEXT; } } - if (activity.useSendButtonToIndicateStatus() && c != null - && c.getAccount().getStatus() == Account.State.ONLINE) { - if (c.getMode() == Conversation.MODE_SINGLE) { + if (activity.useSendButtonToIndicateStatus() && c.getAccount().getStatus() == Account.State.ONLINE) { + if (activity.xmppConnectionService != null && activity.xmppConnectionService.getMessageArchiveService().isCatchingUp(c)) { + status = Presence.Status.OFFLINE; + } else if (c.getMode() == Conversation.MODE_SINGLE) { status = c.getContact().getShownStatus(); } else { status = c.getMucOptions().online() ? Presence.Status.ONLINE : Presence.Status.OFFLINE; |