[app] Browser is disabled? (#1164)

This commit is contained in:
南宫雪珊 2021-09-24 09:10:35 +08:00 committed by GitHub
parent fb9ab9d9bd
commit bdbe9ca3f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -21,7 +21,9 @@
package org.lsposed.manager.util;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.net.Uri;
import android.widget.Toast;
import androidx.browser.customtabs.CustomTabColorSchemeParams;
import androidx.browser.customtabs.CustomTabsIntent;
@ -41,7 +43,11 @@ public final class NavUtil {
customTabsIntent.setDefaultColorSchemeParams(params);
boolean night = ResourceUtils.isNightMode(activity.getResources().getConfiguration());
customTabsIntent.setColorScheme(night ? CustomTabsIntent.COLOR_SCHEME_DARK : CustomTabsIntent.COLOR_SCHEME_LIGHT);
customTabsIntent.build().launchUrl(activity, uri);
try {
customTabsIntent.build().launchUrl(activity, uri);
} catch (ActivityNotFoundException ignored) {
Toast.makeText(activity, uri.toString(), Toast.LENGTH_SHORT).show();
}
}
public static void startURL(Activity activity, String url) {