本文整理汇总了Java中android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT属性的典型用法代码示例。如果您正苦于以下问题:Java Intent.FLAG_ACTIVITY_NEW_DOCUMENT属性的具体用法?Java Intent.FLAG_ACTIVITY_NEW_DOCUMENT怎么用?Java Intent.FLAG_ACTIVITY_NEW_DOCUMENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.Intent
的用法示例。
在下文中一共展示了Intent.FLAG_ACTIVITY_NEW_DOCUMENT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getActivityNewDocumentFlag
@SuppressWarnings("deprecation")
public static int getActivityNewDocumentFlag() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
} else {
return Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET;
}
}
示例2: createCustomTabActivityIntent
/**
* Creates an Intent that can be used to launch a {@link CustomTabActivity}.
*/
public static Intent createCustomTabActivityIntent(
Context context, Intent intent, boolean addHerbExtras) {
// Use the copy constructor to carry over the myriad of extras.
Uri uri = Uri.parse(IntentHandler.getUrlFromIntent(intent));
Intent newIntent = new Intent(intent);
newIntent.setAction(Intent.ACTION_VIEW);
newIntent.setClassName(context, CustomTabActivity.class.getName());
newIntent.setData(uri);
// If a CCT intent triggers First Run, then NEW_TASK will be automatically applied. As
// part of that, it will inherit the EXCLUDE_FROM_RECENTS bit from ChromeLauncherActivity,
// so explicitly remove it to ensure the CCT does not get lost in recents.
if ((newIntent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) != 0
|| (newIntent.getFlags() & Intent.FLAG_ACTIVITY_NEW_DOCUMENT) != 0) {
newIntent.setFlags(
newIntent.getFlags() & ~Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
}
if (addHerbExtras) {
// TODO(tedchoc|mariakhomenko): Specifically not marking the intent is from Chrome via
// IntentHandler.addTrustedIntentExtras as it breaks the
// redirect logic for triggering instant apps. See if
// this is better addressed in TabRedirectHandler long
// term.
newIntent.putExtra(CustomTabIntentDataProvider.EXTRA_IS_OPENED_BY_CHROME, true);
} else {
IntentUtils.safeRemoveExtra(
intent, CustomTabIntentDataProvider.EXTRA_IS_OPENED_BY_CHROME);
}
if (addHerbExtras) updateHerbIntent(context, newIntent);
return newIntent;
}
示例3: recordIntentMetrics
/**
* Records metrics gleaned from the Intent.
*/
private void recordIntentMetrics() {
Intent intent = getIntent();
IntentHandler.ExternalAppId source =
IntentHandler.determineExternalIntentSource(getPackageName(), intent);
if (intent.getPackage() == null && source != IntentHandler.ExternalAppId.CHROME) {
int flagsOfInterest = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
int maskedFlags = intent.getFlags() & flagsOfInterest;
sIntentFlagsHistogram.record(maskedFlags);
}
MediaNotificationUma.recordClickSource(intent);
}
示例4: getFlagForUrlLink
private int getFlagForUrlLink() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
return Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET;
} else {
return Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
}
}