Merge branch 'Mess' of https://github.com/tarun018/Conversations into tarun018-Mess
This commit is contained in:
commit
d3542202b5
|
@ -17,6 +17,7 @@ import android.text.Spanned;
|
||||||
import android.text.style.ForegroundColorSpan;
|
import android.text.style.ForegroundColorSpan;
|
||||||
import android.text.style.RelativeSizeSpan;
|
import android.text.style.RelativeSizeSpan;
|
||||||
import android.text.style.StyleSpan;
|
import android.text.style.StyleSpan;
|
||||||
|
import android.text.util.Linkify;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Patterns;
|
import android.util.Patterns;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -35,6 +36,7 @@ import java.net.URL;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.RejectedExecutionException;
|
import java.util.concurrent.RejectedExecutionException;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession;
|
import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession;
|
||||||
|
@ -54,6 +56,11 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
private static final int SENT = 0;
|
private static final int SENT = 0;
|
||||||
private static final int RECEIVED = 1;
|
private static final int RECEIVED = 1;
|
||||||
private static final int STATUS = 2;
|
private static final int STATUS = 2;
|
||||||
|
private static final Pattern XMPP_PATTERN = Pattern
|
||||||
|
.compile("xmpp\\:(?:(?:["
|
||||||
|
+ Patterns.GOOD_IRI_CHAR
|
||||||
|
+ "\\;\\/\\?\\@\\&\\=\\#\\~\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])"
|
||||||
|
+ "|(?:\\%[a-fA-F0-9]{2}))+");
|
||||||
|
|
||||||
private ConversationActivity activity;
|
private ConversationActivity activity;
|
||||||
|
|
||||||
|
@ -350,6 +357,9 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
urlCount++;
|
urlCount++;
|
||||||
}
|
}
|
||||||
viewHolder.messageBody.setTextIsSelectable(urlCount <= 1);
|
viewHolder.messageBody.setTextIsSelectable(urlCount <= 1);
|
||||||
|
viewHolder.messageBody.setAutoLinkMask(0);
|
||||||
|
Linkify.addLinks(viewHolder.messageBody, Linkify.WEB_URLS);
|
||||||
|
Linkify.addLinks(viewHolder.messageBody, XMPP_PATTERN, "xmpp");
|
||||||
} else {
|
} else {
|
||||||
viewHolder.messageBody.setText("");
|
viewHolder.messageBody.setText("");
|
||||||
viewHolder.messageBody.setTextIsSelectable(false);
|
viewHolder.messageBody.setTextIsSelectable(false);
|
||||||
|
|
Loading…
Reference in a new issue