本文整理匯總了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;
}