fix issue with markdown links

This commit is contained in:
adbenitez
2021-04-17 16:38:07 -04:00
parent 7d4c08449a
commit ddaf094a44
2 changed files with 6 additions and 5 deletions
@@ -394,11 +394,13 @@ public class ConversationItem extends LinearLayout
bodyText.setVisibility(View.GONE);
}
else {
Spannable spannable = (Spannable)markwon.toMarkdown(text);
if (batchSelected.isEmpty()) {
Spannable spannable = (Spannable)markwon.toMarkdown(text);
spannable = EmojiTextView.linkify(spannable);
bodyText.setText(spannable);
} else {
bodyText.setText(text);
}
bodyText.setText(spannable);
bodyText.setVisibility(View.VISIBLE);
}
@@ -227,9 +227,8 @@ public class EmojiTextView extends AppCompatTextView {
public static Spannable linkify(Spannable messageBody) {
// linkify commands such as `/echo` -
// do this first to avoid `/xkcd_123456` to be treated partly as a phone number
if (Linkify.addLinks(messageBody, CMD_PATTERN, "cmd:", null, null)) {
EmojiTextView.replaceURLSpan(messageBody); // replace URLSpan so that it is not removed on the next addLinks() call
}
Linkify.addLinks(messageBody, CMD_PATTERN, "cmd:", null, null);
EmojiTextView.replaceURLSpan(messageBody); // replace URLSpan so that it is not removed on the next addLinks() call
// linkyfiy urls etc., this removes all existing URLSpan
if (Linkify.addLinks(messageBody, Linkify.EMAIL_ADDRESSES|Linkify.WEB_URLS|Linkify.PHONE_NUMBERS)) {