offer to copy error message to clipboard. fixes #3277
This commit is contained in:
parent
6715a4c353
commit
300006a529
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -300,7 +300,8 @@
|
|||
<string name="send_again">Send again</string>
|
||||
<string name="file_url">File URL</string>
|
||||
<string name="url_copied_to_clipboard">Copied URL to clipboard</string>
|
||||
<string name="jabber_id_copied_to_clipboard">Copied Jabberd ID to clipboard</string>
|
||||
<string name="jabber_id_copied_to_clipboard">Copied Jabber ID ID to clipboard</string>
|
||||
<string name="error_message_copied_to_clipboard">Copied error message to clipboard</string>
|
||||
<string name="web_address">web address</string>
|
||||
<string name="scan_qr_code">Scan 2D Barcode</string>
|
||||
<string name="show_qr_code">Show 2D Barcode</string>
|
||||
|
|
Loading…
Reference in a new issue