當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。