Do not show xmpp uris as links that have invalid jids
This commit is contained in:
parent
5885bc7f25
commit
0e6d3db926
|
@ -76,6 +76,7 @@ import eu.siacs.conversations.utils.GeoHelper;
|
|||
import eu.siacs.conversations.utils.Patterns;
|
||||
import eu.siacs.conversations.utils.StylingHelper;
|
||||
import eu.siacs.conversations.utils.UIHelper;
|
||||
import eu.siacs.conversations.utils.XmppUri;
|
||||
import eu.siacs.conversations.xmpp.mam.MamReference;
|
||||
|
||||
public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextView.CopyHandler {
|
||||
|
@ -114,6 +115,14 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
|
|||
}
|
||||
};
|
||||
|
||||
private static final Linkify.MatchFilter XMPPURI_MATCH_FILTER = new Linkify.MatchFilter() {
|
||||
@Override
|
||||
public boolean acceptMatch(CharSequence s, int start, int end) {
|
||||
XmppUri uri = new XmppUri(s.subSequence(start,end).toString());
|
||||
return uri.isJidValid();
|
||||
}
|
||||
};
|
||||
|
||||
private final ConversationActivity activity;
|
||||
|
||||
private DisplayMetrics metrics;
|
||||
|
@ -491,7 +500,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
|
|||
|
||||
StylingHelper.format(body, viewHolder.messageBody.getCurrentTextColor());
|
||||
|
||||
Linkify.addLinks(body, XMPP_PATTERN, "xmpp");
|
||||
Linkify.addLinks(body, XMPP_PATTERN, "xmpp", XMPPURI_MATCH_FILTER, null);
|
||||
Linkify.addLinks(body, Patterns.AUTOLINK_WEB_URL, "http", WEBURL_MATCH_FILTER, WEBURL_TRANSFORM_FILTER);
|
||||
Linkify.addLinks(body, GeoHelper.GEO_URI, "geo");
|
||||
FixedURLSpan.fix(body);
|
||||
|
|
Loading…
Reference in New Issue