aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2017-01-15 18:54:15 +0100
committerDaniel Gultsch <daniel@gultsch.de>2017-01-15 18:54:15 +0100
commitb085426d22000fc39aea595205e83695e9dbc22a (patch)
treef493eb4131ec5da2b0c0230fec1c558de8d806fb /src
parenta71e3d06534724d1881fcc82621613e0751bc1a4 (diff)
fixed linkifier
Diffstat (limited to 'src')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index ce56e30c..6188b629 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -88,6 +88,12 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
}
}
};
+ private static final Linkify.MatchFilter WEBURL_MATCH_FILTER = new Linkify.MatchFilter() {
+ @Override
+ public boolean acceptMatch(CharSequence charSequence, int start, int end) {
+ return start < 1 || charSequence.charAt(start-1) != '@';
+ }
+ };
private ConversationActivity activity;
@@ -442,8 +448,8 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
privateMarkerIndex + 1 + nick.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
- Linkify.addLinks(body, Patterns.AUTOLINK_WEB_URL, "http", null, WEBURL_TRANSFORM_FILTER);
Linkify.addLinks(body, XMPP_PATTERN, "xmpp");
+ Linkify.addLinks(body, Patterns.AUTOLINK_WEB_URL, "http", WEBURL_MATCH_FILTER, WEBURL_TRANSFORM_FILTER);
Linkify.addLinks(body, GeoHelper.GEO_URI, "geo");
viewHolder.messageBody.setAutoLinkMask(0);
viewHolder.messageBody.setText(body);