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

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

Issue 1833763002: Add new NTP layout with snippet cards and hide it behind a flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address more comments Created 4 years, 9 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/NewTabPageListItem.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageListItem.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageListItem.java
new file mode 100644
index 0000000000000000000000000000000000000000..d3ede56f60e33858686266f80d4ba09ef27cf8ea
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageListItem.java
@@ -0,0 +1,50 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.ntp.cards;
+
+import android.support.annotation.IntDef;
+import android.support.v7.widget.RecyclerView.Adapter;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/** Base type for anything to add to the new tab page */
+public interface NewTabPageListItem {
+ /**
+ * View type values for the items that will be held by the NTP's RecyclerView.
+ * @see Adapter#getItemViewType(int)
+ * @see NewTabPageListItem#getType()
+ */
+ @IntDef({VIEW_TYPE_ABOVE_THE_FOLD, VIEW_TYPE_HEADER, VIEW_TYPE_SNIPPET})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ViewType {}
+
+ /**
+ * View type for the above the fold item
+ * @see Adapter#getItemViewType(int)
+ */
+ public static final int VIEW_TYPE_ABOVE_THE_FOLD = 1;
+
+ /**
+ * View type for card group headers
+ * @see Adapter#getItemViewType(int)
+ */
+ public static final int VIEW_TYPE_HEADER = 2;
+
+ /**
+ * View type for snippet cards
+ * @see Adapter#getItemViewType(int)
+ */
+ public static final int VIEW_TYPE_SNIPPET = 3;
+
+ /**
+ * Returns the type ({@link ViewType}) of this list item. This is so we can
+ * distinguish between different elements that are held in a single RecyclerView holder.
+ *
+ * @return the type of this list item.
+ */
+ @ViewType
+ public int getType();
+}

Powered by Google App Engine
This is Rietveld 408576698