当前位置: 首页>>代码示例>>Java>>正文


Java Intent.FLAG_ACTIVITY_NEW_DOCUMENT属性代码示例

本文整理汇总了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;
    }
}
 
开发者ID:lizhangqu,项目名称:chromium-net-for-android,代码行数:8,代码来源:ApiCompatibilityUtils.java

示例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;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:37,代码来源:ChromeLauncherActivity.java

示例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);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:14,代码来源:ChromeLauncherActivity.java

示例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;
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:7,代码来源:SessionDetailModel.java


注:本文中的android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。