本文整理汇总了Java中android.support.customtabs.CustomTabsIntent.shouldAlwaysUseBrowserUI方法的典型用法代码示例。如果您正苦于以下问题:Java CustomTabsIntent.shouldAlwaysUseBrowserUI方法的具体用法?Java CustomTabsIntent.shouldAlwaysUseBrowserUI怎么用?Java CustomTabsIntent.shouldAlwaysUseBrowserUI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.customtabs.CustomTabsIntent
的用法示例。
在下文中一共展示了CustomTabsIntent.shouldAlwaysUseBrowserUI方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canBeHijackedByHerb
import android.support.customtabs.CustomTabsIntent; //导入方法依赖的package包/类
/**
* @return Whether or not an Herb prototype may hijack an Intent.
*/
public static boolean canBeHijackedByHerb(Intent intent) {
String url = IntentHandler.getUrlFromIntent(intent);
// Only VIEW Intents with URLs are rerouted to Custom Tabs.
if (intent == null || !TextUtils.equals(Intent.ACTION_VIEW, intent.getAction())
|| TextUtils.isEmpty(url)) {
return false;
}
// Don't open explicitly opted out intents in custom tabs.
if (CustomTabsIntent.shouldAlwaysUseBrowserUI(intent)) {
return false;
}
// Don't reroute Chrome Intents.
Context context = ContextUtils.getApplicationContext();
if (TextUtils.equals(context.getPackageName(),
IntentUtils.safeGetStringExtra(intent, Browser.EXTRA_APPLICATION_ID))
|| IntentHandler.wasIntentSenderChrome(intent, context)) {
return false;
}
// Don't reroute internal chrome URLs.
try {
URI uri = URI.create(url);
if (UrlUtilities.isInternalScheme(uri)) return false;
} catch (IllegalArgumentException e) {
return false;
}
// Don't reroute Home screen shortcuts.
if (IntentUtils.safeHasExtra(intent, ShortcutHelper.EXTRA_SOURCE)) {
return false;
}
return true;
}
示例2: isCustomTabIntent
import android.support.customtabs.CustomTabsIntent; //导入方法依赖的package包/类
/**
* @return Whether the intent is for launching a Custom Tab.
*/
public static boolean isCustomTabIntent(Intent intent) {
if (intent == null
|| CustomTabsIntent.shouldAlwaysUseBrowserUI(intent)
|| !intent.hasExtra(CustomTabsIntent.EXTRA_SESSION)) {
return false;
}
return IntentHandler.getUrlFromIntent(intent) != null;
}