aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-03-04 18:26:07 +0100
committerChristian Schneppe <christian@pix-art.de>2017-03-04 18:26:07 +0100
commitaa5dba949a0f5b2bbf887e14ffe859e49f768a75 (patch)
tree35c8914ac6845febf3d8a21d0b129eea0be094ca /src/main/java/de/pixart
parentf9f2b6209c25b69303c6c691b5e8d745069d3abc (diff)
Keep draft even when correcting previously sent msg
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/entities/Conversation.java12
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java18
2 files changed, 22 insertions, 8 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Conversation.java b/src/main/java/de/pixart/messenger/entities/Conversation.java
index 7e75600f3..24b45e158 100644
--- a/src/main/java/de/pixart/messenger/entities/Conversation.java
+++ b/src/main/java/de/pixart/messenger/entities/Conversation.java
@@ -59,6 +59,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
public static final String ATTRIBUTE_CRYPTO_TARGETS = "crypto_targets";
public static final String ATTRIBUTE_LAST_CLEAR_HISTORY = "last_clear_history";
+ private String draftMessage;
private String name;
private String contactUuid;
private String accountUuid;
@@ -373,9 +374,8 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
}
public boolean setCorrectingMessage(Message correctingMessage) {
- boolean corrected = this.correctingMessage != null && correctingMessage == null;
this.correctingMessage = correctingMessage;
- return corrected;
+ return correctingMessage == null && draftMessage != null;
}
public Message getCorrectingMessage() {
@@ -399,6 +399,14 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
}
}
+ public String getDraftMessage() {
+ return draftMessage;
+ }
+
+ public void setDraftMessage(String draftMessage) {
+ this.draftMessage = draftMessage;
+ }
+
public interface OnMessageFound {
void onMessageFound(final Message message);
}
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