Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1825)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SectionList.java

Issue 2627603002: [NTP::SectionOrder] Propagate category rank from UI through the bridge. (Closed)
Patch Set: 1-based categoryRank -> 0-based categoryIndex. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SectionList.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SectionList.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SectionList.java
index c4ecfd880faeb8c229a9edc9d5489d7c293eb21d..f75a9f3f8537b4920e58d24840cff1c6c54bf487 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SectionList.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SectionList.java
@@ -51,7 +51,7 @@ public class SectionList
SuggestionsSource suggestionsSource = mNewTabPageManager.getSuggestionsSource();
int[] categories = suggestionsSource.getCategories();
int[] suggestionsPerCategory = new int[categories.length];
- int i = 0;
+ int categoryIndex = 0;
for (int category : categories) {
int categoryStatus = suggestionsSource.getCategoryStatus(category);
if (categoryStatus == CategoryStatus.LOADING_ERROR
@@ -59,8 +59,11 @@ public class SectionList
|| categoryStatus == CategoryStatus.CATEGORY_EXPLICITLY_DISABLED)
continue;
- suggestionsPerCategory[i++] =
+ suggestionsPerCategory[categoryIndex] =
resetSection(category, categoryStatus, alwaysAllowEmptySections);
+ SuggestionsSection section = mSections.get(category);
+ if (section != null) section.setCategoryIndex(categoryIndex);
dgn 2017/01/17 17:53:18 here, we can decide not to show a section because
+ ++categoryIndex;
}
mNewTabPageManager.trackSnippetsPageImpression(categories, suggestionsPerCategory);

Powered by Google App Engine
This is Rietveld 408576698