aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-01-16 20:44:26 +0100
committerChristian Schneppe <christian@pix-art.de>2017-01-16 20:44:26 +0100
commitadfd354f39886f5bcb160085e342104e5538713b (patch)
tree53e412b7204454b4168bd5ea630a38c168291c0f
parent4b8c7dc6304db7cd90d23ab80d85c1d534684ef0 (diff)
fixed linkifier
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
index 6aebe9237..765efd8c4 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -102,6 +102,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;
@@ -479,8 +485,8 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
body.setSpan(new StyleSpan(Typeface.BOLD_ITALIC), privateMarkerIndex + 1, 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);