From 5c789b75cc0e26561198863e1ede2fe42e83f9a3 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 3 Mar 2017 15:21:42 +0100 Subject: [PATCH] fixed messages vanishing after pgp raised error on editing a message --- .../java/eu/siacs/conversations/entities/Conversation.java | 4 +++- .../java/eu/siacs/conversations/ui/ConversationFragment.java | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index b22d9f275..eaf01dd0b 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -356,8 +356,10 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl setAttribute(ATTRIBUTE_CRYPTO_TARGETS, acceptedTargets); } - public void setCorrectingMessage(Message correctingMessage) { + public boolean setCorrectingMessage(Message correctingMessage) { + boolean corrected = this.correctingMessage != null && correctingMessage == null; this.correctingMessage = correctingMessage; + return corrected; } public Message getCorrectingMessage() { diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index fb3f3331c..a8a1d0ba7 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -395,7 +395,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa message.setBody(body); message.setEdited(message.getUuid()); message.setUuid(UUID.randomUUID().toString()); - conversation.setCorrectingMessage(null); } switch (conversation.getNextEncryption()) { case Message.ENCRYPTION_OTR: @@ -1073,7 +1072,8 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa protected void messageSent() { mSendingPgpMessage.set(false); - mEditMessage.setText(""); + mEditMessage.getEditableText().clear(); + conversation.setCorrectingMessage(null); updateChatMsgHint(); new Handler().post(new Runnable() { @Override