diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
index 0cdfaaaff..958dda384 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
@@ -1117,9 +1117,10 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
MenuItem cancelTransmission = menu.findItem(R.id.cancel_transmission);
MenuItem deleteFile = menu.findItem(R.id.delete_file);
MenuItem showErrorMessage = menu.findItem(R.id.show_error_message);
+ final boolean showError = m.getStatus() == Message.STATUS_SEND_FAILED && m.getErrorMessage() != null && !Message.ERROR_MESSAGE_CANCELLED.equals(m.getErrorMessage());
if (!m.isFileOrImage() && !encrypted && !m.isGeoUri() && !m.treatAsDownloadable()) {
copyMessage.setVisible(true);
- quoteMessage.setVisible(MessageUtils.prepareQuote(m).length() > 0);
+ quoteMessage.setVisible(!showError && MessageUtils.prepareQuote(m).length() > 0);
String body = m.getMergedBody().toString();
if (ShareUtil.containsXmppUri(body)) {
copyLink.setTitle(R.string.copy_jabber_id);
@@ -1131,7 +1132,8 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
if (m.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) {
retryDecryption.setVisible(true);
}
- if (relevantForCorrection.getType() == Message.TYPE_TEXT
+ if (!showError
+ && relevantForCorrection.getType() == Message.TYPE_TEXT
&& relevantForCorrection.isLastCorrectableMessage()
&& m.getConversation() instanceof Conversation
&& (((Conversation) m.getConversation()).getMucOptions().nonanonymous() || m.getConversation().getMode() == Conversation.MODE_SINGLE)) {
@@ -1167,7 +1169,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
deleteFile.setTitle(activity.getString(R.string.delete_x_file, UIHelper.getFileDescriptionString(activity, m)));
}
}
- if (m.getStatus() == Message.STATUS_SEND_FAILED && m.getErrorMessage() != null && !Message.ERROR_MESSAGE_CANCELLED.equals(m.getErrorMessage())) {
+ if (showError) {
showErrorMessage.setVisible(true);
}
}
@@ -1656,6 +1658,10 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.error_message);
builder.setMessage(message.getErrorMessage());
+ builder.setNegativeButton(R.string.copy_to_clipboard, (dialog, which) -> {
+ activity.copyTextToClipboard(message.getErrorMessage(),R.string.error_message);
+ Toast.makeText(activity,R.string.error_message_copied_to_clipboard, Toast.LENGTH_SHORT).show();
+ });
builder.setPositiveButton(R.string.confirm, null);
builder.create().show();
}
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 23197ba9c..2d96304d0 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -300,7 +300,8 @@
Send again
File URL
Copied URL to clipboard
- Copied Jabberd ID to clipboard
+ Copied Jabber ID ID to clipboard
+ Copied error message to clipboard
web address
Scan 2D Barcode
Show 2D Barcode