Switch to LinkifyCompat.

We've seen some inconsistencies across OEMs with Linkify. Hopefully
LinkifyCompat will resolve them.
This commit is contained in:
Greyson Parrelli
2021-06-26 00:27:06 -04:00
parent 5bf23dcfb3
commit fce362960f
4 changed files with 8 additions and 4 deletions

View File

@@ -16,6 +16,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.core.text.util.LinkifyCompat;
import androidx.lifecycle.ViewModelProviders;
import com.annimon.stream.Stream;
@@ -170,7 +171,7 @@ public class LongMessageActivity extends PassphraseRequiredActivity {
private SpannableString linkifyMessageBody(SpannableString messageBody) {
int linkPattern = Linkify.WEB_URLS | Linkify.EMAIL_ADDRESSES | Linkify.PHONE_NUMBERS;
boolean hasLinks = Linkify.addLinks(messageBody, linkPattern);
boolean hasLinks = LinkifyCompat.addLinks(messageBody, linkPattern);
if (hasLinks) {
Stream.of(messageBody.getSpans(0, messageBody.length(), URLSpan.class))