diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index b09747135..a9f4888f1 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -1542,21 +1542,30 @@ public class ConversationActivity extends XmppActivity new UiCallback() { @Override - public void userInputRequried(PendingIntent pi, - Message message) { - ConversationActivity.this.runIntent(pi, - ConversationActivity.REQUEST_SEND_MESSAGE); + public void userInputRequried(PendingIntent pi,Message message) { + ConversationActivity.this.runIntent(pi,ConversationActivity.REQUEST_SEND_MESSAGE); } @Override public void success(Message message) { message.setEncryption(Message.ENCRYPTION_DECRYPTED); xmppConnectionService.sendMessage(message); + if (mConversationFragment != null) { + mConversationFragment.messageSent(); + } } @Override - public void error(int error, Message message) { - + public void error(final int error, Message message) { + runOnUiThread(new Runnable() { + @Override + public void run() { + Toast.makeText(ConversationActivity.this, + R.string.unable_to_connect_to_keychain, + Toast.LENGTH_SHORT + ).show(); + } + }); } }); } diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index fafd7646a..9c2a7d08c 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -916,7 +916,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } } - private void messageSent() { + protected void messageSent() { mEditMessage.setText(""); updateChatMsgHint(); new Handler().post(new Runnable() { @@ -1172,7 +1172,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa @Override public void success(Contact contact) { - messageSent(); activity.encryptTextMessage(message); } @@ -1210,7 +1209,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa warning.show(); } activity.encryptTextMessage(message); - messageSent(); } else { showNoPGPKeyDialog(true, new DialogInterface.OnClickListener() {