aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-09-26 21:30:04 +0200
committerChristian Schneppe <christian@pix-art.de>2018-09-26 21:30:04 +0200
commitd19ee1daad39618740564a5f90a7caa091abc334 (patch)
treea93678893a529cc6be8a935e3dbd1a280dbe6c2e /src
parenta8a7e2c3a773e8e546c4ee6d09cf511f1d532600 (diff)
commit next message (draft) when input box gets emptied. causes tablet view to update
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java31
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();
}