diff options
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 7e07d251b..460695779 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -2098,10 +2098,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } if (this.conversation != null) { final String msg = this.binding.textinput.getText().toString(); - final boolean participating = conversation.getMode() == Conversational.MODE_SINGLE || conversation.getMucOptions().participating(); - if (this.conversation.getStatus() != Conversation.STATUS_ARCHIVED && participating && this.conversation.setNextMessage(msg)) { - this.activity.xmppConnectionService.updateConversation(this.conversation); - } + storeNextMessage(msg); updateChatState(this.conversation, msg); this.activity.xmppConnectionService.getNotificationService().setOpenConversation(null); } @@ -2123,10 +2120,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } Log.d(Config.LOGTAG, "ConversationFragment.saveMessageDraftStopAudioPlayer()"); final String msg = this.binding.textinput.getText().toString(); - final boolean participating = previousConversation.getMode() == Conversational.MODE_SINGLE || previousConversation.getMucOptions().participating(); - if (participating && previousConversation.setNextMessage(msg)) { - activity.xmppConnectionService.updateConversation(previousConversation); - } + storeNextMessage(msg); updateChatState(this.conversation, msg); messageListAdapter.stopAudioPlayer(); mediaPreviewAdapter.clearPreviews(); @@ -2520,10 +2514,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke this.binding.textinput.append(conversation.getDraftMessage()); conversation.setDraftMessage(null); } - final boolean participating = conversation.getMode() == Conversational.MODE_SINGLE || conversation.getMucOptions().participating(); - if (participating && conversation.setNextMessage(this.binding.textinput.getText().toString())) { - activity.xmppConnectionService.databaseBackend.updateConversation(conversation); - } + storeNextMessage(); updateChatMsgHint(); SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(activity); final boolean prefScrollToBottom = p.getBoolean("scroll_to_bottom", activity.getResources().getBoolean(R.bool.scroll_to_bottom)); @@ -2535,6 +2526,19 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } } + private boolean storeNextMessage() { + return storeNextMessage(this.binding.textinput.getText().toString()); + } + + private boolean storeNextMessage(String msg) { + final boolean participating = conversation.getMode() == Conversational.MODE_SINGLE || conversation.getMucOptions().participating(); + if (this.conversation.getStatus() != Conversation.STATUS_ARCHIVED && participating && this.conversation.setNextMessage(msg)) { + this.activity.xmppConnectionService.updateConversation(this.conversation); + return true; + } + return false; + } + public void doneSendingPgpMessage() { mSendingPgpMessage.set(false); } @@ -2897,6 +2901,9 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke if (status == Account.State.ONLINE && conversation.setOutgoingChatState(Config.DEFAULT_CHATSTATE)) { service.sendChatState(conversation); } + if (storeNextMessage()) { + activity.onConversationsListItemUpdated(); + } updateSendButton(); } |