diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-03-04 18:26:07 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-03-04 18:26:07 +0100 |
commit | aa5dba949a0f5b2bbf887e14ffe859e49f768a75 (patch) | |
tree | 35c8914ac6845febf3d8a21d0b129eea0be094ca /src/main/java/de/pixart/messenger/ui | |
parent | f9f2b6209c25b69303c6c691b5e8d745069d3abc (diff) |
Keep draft even when correcting previously sent msg
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 801c47e60..8e8fb5e46 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -355,11 +355,11 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa break; case CANCEL: if (conversation != null) { - if (conversation.getCorrectingMessage() != null) { - conversation.setCorrectingMessage(null); + if (conversation.setCorrectingMessage(null)) { mEditMessage.getEditableText().clear(); - } - if (conversation.getMode() == Conversation.MODE_MULTI) { + mEditMessage.getEditableText().append(conversation.getDraftMessage()); + conversation.setDraftMessage(null); + } else if (conversation.getMode() == Conversation.MODE_MULTI) { conversation.setNextCounterpart(null); } updateChatMsgHint(); @@ -873,6 +873,8 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa message = message.next(); } this.conversation.setCorrectingMessage(message); + final Editable editable = mEditMessage.getText(); + this.conversation.setDraftMessage(editable.toString()); this.mEditMessage.getEditableText().clear(); this.mEditMessage.getEditableText().append(message.getBody()); @@ -1107,8 +1109,12 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } protected void messageSent() { - mEditMessage.getEditableText().clear(); - conversation.setCorrectingMessage(null); + Editable editable = mEditMessage.getEditableText(); + editable.clear(); + if (conversation.setCorrectingMessage(null)) { + editable.append(conversation.getDraftMessage()); + conversation.setDraftMessage(null); + } updateChatMsgHint(); new Handler().post(new Runnable() { @Override |