package net.squanchy.tweets.parsing;

import android.util.Patterns;

import java.util.regex.Pattern;

import net.squanchy.tweets.domain.view.UrlEntity;
import net.squanchy.tweets.model.TweetSpecialTextData;

class UrlParser extends TweetParserTemplate<UrlEntity> {

    @Override
    Pattern pattern() {
        return Patterns.WEB_URL;
    }

    @Override
    UrlEntity convertFrom(TweetSpecialTextData data) {
        return UrlEntity.create(data.text(), data.begin(), data.end());
    }
}

package net.squanchy.tweets.parsing;

import android.support.v4.util.PatternsCompat;

import java.util.regex.Pattern;

import net.squanchy.tweets.domain.view.UrlEntity;
import net.squanchy.tweets.model.TweetSpecialTextData;

class UrlParser extends TweetParserTemplate<UrlEntity> {

    @Override
    Pattern pattern() {
        return PatternsCompat.WEB_URL;
    }

    @Override
    UrlEntity convertFrom(TweetSpecialTextData data) {
        return UrlEntity.create(data.text(), data.begin(), data.end());
    }
}

Use PatternsCompat in UrlParser