|
|
|
@ -598,6 +598,21 @@ public class SpannableHelper {
|
|
|
|
|
public void onClick(@NonNull View textView) {
|
|
|
|
|
|
|
|
|
|
textView.setTag(CLICKABLE_SPAN);
|
|
|
|
|
linkClickAction(context, finalUrl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateDrawState(@NonNull TextPaint ds) {
|
|
|
|
|
super.updateDrawState(ds);
|
|
|
|
|
ds.setUnderlineText(false);
|
|
|
|
|
if (linkColor != -1) {
|
|
|
|
|
ds.setColor(linkColor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, start, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void linkClickAction(Context context, String finalUrl) {
|
|
|
|
|
Pattern link = Pattern.compile("https?://([\\da-z.-]+\\.[a-z.]{2,10})/(@[\\w._-]*[0-9]*)(/[0-9]+)?$");
|
|
|
|
|
Matcher matcherLink = link.matcher(finalUrl);
|
|
|
|
|
Pattern linkLong = Pattern.compile("https?://([\\da-z.-]+\\.[a-z.]{2,10})/(@[\\w_.-]+@[a-zA-Z0-9][a-zA-Z0-9.-]{1,61}[a-zA-Z0-9](?:\\.[a-zA-Z]{2,})+)(/[0-9]+)?$");
|
|
|
|
@ -705,18 +720,6 @@ public class SpannableHelper {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateDrawState(@NonNull TextPaint ds) {
|
|
|
|
|
super.updateDrawState(ds);
|
|
|
|
|
ds.setUnderlineText(false);
|
|
|
|
|
if (linkColor != -1) {
|
|
|
|
|
ds.setColor(linkColor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, start, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void emails(Context context, Spannable content) {
|
|
|
|
|
// --- For all patterns defined in Helper class ---
|
|
|
|
|
Pattern pattern = Helper.emailPattern;
|
|
|
|
|