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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java

Issue 2532953002: [Android NTP] Reduce API surface of NewTabPageAdapter. (Closed)
Patch Set: move Created 4 years 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/snippets/SnippetArticleViewHolder.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java
index 5109920f716aaca927eca672e850155a91d3980f..3eb3a43cedbed68f480e5edf0336ebb4b41d407f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java
@@ -66,6 +66,7 @@ public class SnippetArticleViewHolder
private FetchImageCallback mImageCallback;
private SnippetArticle mArticle;
+ private SuggestionsCategoryInfo mCategoryInfo;
private int mPublisherFaviconSizePx;
private final boolean mUseFaviconService;
@@ -149,10 +150,9 @@ public class SnippetArticleViewHolder
* Updates the layout taking into account screen dimensions and the type of snippet displayed.
*/
private void updateLayout() {
- SuggestionsCategoryInfo info =
- mRecyclerView.getNewTabPageAdapter().getCategoryInfo(mArticle.mCategory);
boolean narrow = mUiConfig.getCurrentDisplayStyle() == UiConfig.DISPLAY_STYLE_NARROW;
- boolean minimal = info.getCardLayout() == ContentSuggestionsCardLayout.MINIMAL_CARD;
+ boolean minimal =
+ mCategoryInfo.getCardLayout() == ContentSuggestionsCardLayout.MINIMAL_CARD;
// If the screen is narrow or we are using the minimal layout, hide the article snippet.
boolean hideSnippet = narrow || minimal;
@@ -185,13 +185,14 @@ public class SnippetArticleViewHolder
mPublisherBar.setLayoutParams(params);
}
- public void onBindViewHolder(SnippetArticle article) {
+ public void onBindViewHolder(SnippetArticle article, SuggestionsCategoryInfo categoryInfo) {
super.onBindViewHolder();
// No longer listen for offline status changes to the old article.
if (mArticle != null) mArticle.setOfflineStatusChangeRunnable(null);
mArticle = article;
+ mCategoryInfo = categoryInfo;
updateLayout();
mHeadlineTextView.setText(mArticle.mTitle);

Powered by Google App Engine
This is Rietveld 408576698