本文整理汇总了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);
}
示例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;
}
示例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;
}