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


Java SnippetsBridge.isCategoryEnabled方法代码示例

本文整理汇总了Java中org.chromium.chrome.browser.ntp.snippets.SnippetsBridge.isCategoryEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java SnippetsBridge.isCategoryEnabled方法的具体用法?Java SnippetsBridge.isCategoryEnabled怎么用?Java SnippetsBridge.isCategoryEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.chromium.chrome.browser.ntp.snippets.SnippetsBridge的用法示例。


在下文中一共展示了SnippetsBridge.isCategoryEnabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resetSections

import org.chromium.chrome.browser.ntp.snippets.SnippetsBridge; //导入方法依赖的package包/类
/**
 * Resets the sections, reloading the whole new tab page content.
 * @param alwaysAllowEmptySections Whether sections are always allowed to be displayed when
 *     they are empty, even when they are normally not.
 */
private void resetSections(boolean alwaysAllowEmptySections) {
    removeAllSections();

    SuggestionsSource suggestionsSource = mUiDelegate.getSuggestionsSource();
    int[] categories = suggestionsSource.getCategories();
    int[] suggestionsPerCategory = new int[categories.length];
    int visibleCategoriesCount = 0;
    int categoryIndex = 0;
    for (int category : categories) {
        int categoryStatus = suggestionsSource.getCategoryStatus(category);
        int suggestionsCount = 0;
        if (SnippetsBridge.isCategoryEnabled(categoryStatus)) {
            suggestionsCount = resetSection(category, categoryStatus, alwaysAllowEmptySections);
            if (mSections.get(category) != null) ++visibleCategoriesCount;
        }
        suggestionsPerCategory[categoryIndex] = suggestionsCount;
        ++categoryIndex;
    }

    maybeHideArticlesHeader();
    mUiDelegate.getEventReporter().onPageShown(
            categories, suggestionsPerCategory, visibleCategoriesCount);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:29,代码来源:SectionList.java

示例2: canProcessSuggestions

import org.chromium.chrome.browser.ntp.snippets.SnippetsBridge; //导入方法依赖的package包/类
/**
 * Returns whether the category is able to process the suggestions. The category might decide
 * not to show incoming suggestions later, but this check ensures it's in a basic state
 * compatible with displaying content.
 */
private boolean canProcessSuggestions(@CategoryInt int category, @CategoryStatus int status) {
    // If the category was blacklisted, we note that there might be new content to show.
    mBlacklistedCategories.remove(category);

    // We never want to add suggestions from unknown categories.
    if (!mSections.containsKey(category)) return false;

    // The status may have changed while the suggestions were loading, perhaps they should not
    // be displayed any more.
    if (!SnippetsBridge.isCategoryEnabled(status)) {
        Log.w(TAG, "Received suggestions for a disabled category (id=%d, status=%d)", category,
                status);
        return false;
    }

    return true;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:23,代码来源:SectionList.java

示例3: canLoadSuggestions

import org.chromium.chrome.browser.ntp.snippets.SnippetsBridge; //导入方法依赖的package包/类
private boolean canLoadSuggestions(@CategoryInt int category, @CategoryStatusEnum int status) {
    // We never want to add suggestions from unknown categories.
    if (!mSections.containsKey(category)) return false;

    // The status may have changed while the suggestions were loading, perhaps they should not
    // be displayed any more.
    if (!SnippetsBridge.isCategoryEnabled(status)) {
        Log.w(TAG, "Received suggestions for a disabled category (id=%d, status=%d)", category,
                status);
        return false;
    }

    return true;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:15,代码来源:NewTabPageAdapter.java


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