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

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

Issue 2235463002: Change Snippet layout based on Category. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge in master. Created 4 years, 4 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/snippets/SnippetArticleListItem.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleListItem.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleListItem.java
index e10051f11ba881a176867c5acaef6cd958066bd4..54fc60ab6fbc0739e91c2c1b684570c0cc45996f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleListItem.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleListItem.java
@@ -8,6 +8,7 @@ import android.graphics.Bitmap;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.browser.ntp.NewTabPageUma;
import org.chromium.chrome.browser.ntp.cards.NewTabPageListItem;
+import org.chromium.chrome.browser.ntp.snippets.ContentSuggestionsCardLayout.ContentSuggestionsCardLayoutEnum;
/**
* Represents the data for an article card on the NTP.
@@ -40,6 +41,10 @@ public class SnippetArticleListItem implements NewTabPageListItem {
/** The position of this article in the whole list of snippets. */
public final int mPosition;
+ /** The layout that should be used to display the snippet. */
+ @ContentSuggestionsCardLayoutEnum
+ public final int mCardLayout;
+
/** Bitmap of the thumbnail, fetched lazily, when the RecyclerView wants to show the snippet. */
private Bitmap mThumbnailBitmap;
@@ -53,7 +58,8 @@ public class SnippetArticleListItem implements NewTabPageListItem {
* Creates a SnippetArticleListItem object that will hold the data.
*/
public SnippetArticleListItem(String id, String title, String publisher, String previewText,
- String url, String ampUrl, long timestamp, float score, int position) {
+ String url, String ampUrl, long timestamp, float score, int position,
+ @ContentSuggestionsCardLayoutEnum int cardLayout) {
mId = id;
mTitle = title;
mPublisher = publisher;
@@ -63,6 +69,7 @@ public class SnippetArticleListItem implements NewTabPageListItem {
mPublishTimestampMilliseconds = timestamp;
mScore = score;
mPosition = position;
+ mCardLayout = cardLayout;
}
@Override

Powered by Google App Engine
This is Rietveld 408576698