From 30ed6b3cec5c3d7394f6ee8b78599aec3e940d79 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 19 Mar 2017 20:15:07 +0100 Subject: [PATCH] call messageSent() from UI thread after encrypting pgp message --- .../conversations/ui/ConversationActivity.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 3234cb0a1..a93a12151 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -1689,9 +1689,12 @@ public class ConversationActivity extends XmppActivity public void success(Message message) { message.setEncryption(Message.ENCRYPTION_DECRYPTED); xmppConnectionService.sendMessage(message); - if (mConversationFragment != null) { - mConversationFragment.messageSent(); - } + runOnUiThread(new Runnable() { + @Override + public void run() { + mConversationFragment.messageSent(); + } + }); } @Override @@ -1699,15 +1702,14 @@ public class ConversationActivity extends XmppActivity runOnUiThread(new Runnable() { @Override public void run() { + mConversationFragment.doneSendingPgpMessage(); Toast.makeText(ConversationActivity.this, R.string.unable_to_connect_to_keychain, Toast.LENGTH_SHORT ).show(); } }); - if (mConversationFragment != null) { - mConversationFragment.doneSendingPgpMessage(); - } + } }); }