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(); |
+} |