use of org.nibor.autolink.LinkExtractor in project Rocket.Chat.Android by RocketChat.
the class Linkify method markupInner.
private static SpannableString markupInner(final CharSequence text) {
LinkExtractor linkExtractor = LinkExtractor.builder().linkTypes(sTargetType).build();
SpannableString spannableString = new SpannableString(text);
for (LinkSpan link : linkExtractor.extractLinks(text)) {
final int idx1 = link.getBeginIndex();
final int idx2 = link.getEndIndex();
final String url = text.subSequence(idx1, idx2).toString();
spannableString.setSpan(MarkDown.createLinkSpan(url), idx1, idx2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
return spannableString;
}
Aggregations