[app] Use linkifycompat
This commit is contained in:
parent
7116662a3f
commit
3ace604eff
|
|
@ -103,7 +103,7 @@ public class RepoItemActivity extends BaseActivity {
|
||||||
.usePlugin(TaskListPlugin.create(this))
|
.usePlugin(TaskListPlugin.create(this))
|
||||||
.usePlugin(HtmlPlugin.create())
|
.usePlugin(HtmlPlugin.create())
|
||||||
.usePlugin(GlideImagesPlugin.create(GlideApp.with(this)))
|
.usePlugin(GlideImagesPlugin.create(GlideApp.with(this)))
|
||||||
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
|
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS, true))
|
||||||
.usePlugin(SoftBreakAddsNewLinePlugin.create())
|
.usePlugin(SoftBreakAddsNewLinePlugin.create())
|
||||||
.build();
|
.build();
|
||||||
module = RepoLoader.getInstance().getOnlineModule(modulePackageName);
|
module = RepoLoader.getInstance().getOnlineModule(modulePackageName);
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
package io.github.lsposed.manager.util;
|
package io.github.lsposed.manager.util;
|
||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.text.Spannable;
|
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.text.style.URLSpan;
|
|
||||||
import android.text.util.Linkify;
|
|
||||||
|
|
||||||
import androidx.browser.customtabs.CustomTabColorSchemeParams;
|
import androidx.browser.customtabs.CustomTabColorSchemeParams;
|
||||||
import androidx.browser.customtabs.CustomTabsIntent;
|
import androidx.browser.customtabs.CustomTabsIntent;
|
||||||
|
|
@ -14,17 +10,6 @@ import io.github.lsposed.manager.ui.activity.BaseActivity;
|
||||||
|
|
||||||
public final class NavUtil {
|
public final class NavUtil {
|
||||||
|
|
||||||
public static Uri parseURL(String str) {
|
|
||||||
if (str == null || str.isEmpty())
|
|
||||||
return null;
|
|
||||||
|
|
||||||
Spannable spannable = new SpannableString(str);
|
|
||||||
Linkify.addLinks(spannable, Linkify.WEB_URLS | Linkify.EMAIL_ADDRESSES);
|
|
||||||
|
|
||||||
URLSpan[] spans = spannable.getSpans(0, spannable.length(), URLSpan.class);
|
|
||||||
return (spans.length > 0) ? Uri.parse(spans[0].getURL()) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void startURL(BaseActivity activity, Uri uri) {
|
public static void startURL(BaseActivity activity, Uri uri) {
|
||||||
CustomTabsIntent.Builder customTabsIntent = new CustomTabsIntent.Builder();
|
CustomTabsIntent.Builder customTabsIntent = new CustomTabsIntent.Builder();
|
||||||
customTabsIntent.setShowTitle(true);
|
customTabsIntent.setShowTitle(true);
|
||||||
|
|
@ -40,6 +25,6 @@ public final class NavUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void startURL(BaseActivity activity, String url) {
|
public static void startURL(BaseActivity activity, String url) {
|
||||||
startURL(activity, parseURL(url));
|
startURL(activity, Uri.parse(url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue