Merge branch 'master' of https://github.com/gjedeer/Conversations into gjedeer-master
This commit is contained in:
commit
b3f50d1ad0
|
@ -356,10 +356,15 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
urlCount++;
|
urlCount++;
|
||||||
}
|
}
|
||||||
|
Matcher geoMatcher = GeoHelper.GEO_URI.matcher(body);
|
||||||
|
while (matcher.find()) {
|
||||||
|
urlCount++;
|
||||||
|
}
|
||||||
viewHolder.messageBody.setTextIsSelectable(urlCount <= 1);
|
viewHolder.messageBody.setTextIsSelectable(urlCount <= 1);
|
||||||
viewHolder.messageBody.setAutoLinkMask(0);
|
viewHolder.messageBody.setAutoLinkMask(0);
|
||||||
Linkify.addLinks(viewHolder.messageBody, Linkify.WEB_URLS);
|
Linkify.addLinks(viewHolder.messageBody, Linkify.WEB_URLS);
|
||||||
Linkify.addLinks(viewHolder.messageBody, XMPP_PATTERN, "xmpp");
|
Linkify.addLinks(viewHolder.messageBody, XMPP_PATTERN, "xmpp");
|
||||||
|
Linkify.addLinks(viewHolder.messageBody, GeoHelper.GEO_URI, "geo");
|
||||||
} else {
|
} else {
|
||||||
viewHolder.messageBody.setText("");
|
viewHolder.messageBody.setText("");
|
||||||
viewHolder.messageBody.setTextIsSelectable(false);
|
viewHolder.messageBody.setTextIsSelectable(false);
|
||||||
|
|
|
@ -14,7 +14,7 @@ import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
|
|
||||||
public class GeoHelper {
|
public class GeoHelper {
|
||||||
private static Pattern GEO_URI = Pattern.compile("geo:([\\-0-9.]+),([\\-0-9.]+)(?:,([\\-0-9.]+))?(?:\\?(.*))?", Pattern.CASE_INSENSITIVE);
|
public static Pattern GEO_URI = Pattern.compile("geo:([\\-0-9.]+),([\\-0-9.]+)(?:,([\\-0-9.]+))?(?:\\?(.*))?", Pattern.CASE_INSENSITIVE);
|
||||||
|
|
||||||
public static boolean isGeoUri(String body) {
|
public static boolean isGeoUri(String body) {
|
||||||
return body != null && GEO_URI.matcher(body).matches();
|
return body != null && GEO_URI.matcher(body).matches();
|
||||||
|
|
Loading…
Reference in a new issue