Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/ItemViewType.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/ItemViewType.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/ItemViewType.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e2dd6f79149857f6e9d449eb82bda4b5152ec011 |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/ItemViewType.java |
| @@ -0,0 +1,93 @@ |
| +// 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; |
| + |
| +/** |
| + * View type values for the items that will be held by the NTP's RecyclerView. |
| + * |
| + * @see Adapter#getItemViewType(int) |
| + */ |
| +@IntDef({ |
| + ItemViewType.VIEW_TYPE_ABOVE_THE_FOLD, |
|
dgn
2016/10/13 15:42:41
nit: remove the VIEW_TYPE prefix on the constants?
Bernhard Bauer
2016/10/13 16:13:13
Done.
|
| + ItemViewType.VIEW_TYPE_HEADER, |
| + ItemViewType.VIEW_TYPE_SNIPPET, |
| + ItemViewType.VIEW_TYPE_SPACING, |
| + ItemViewType.VIEW_TYPE_STATUS, |
| + ItemViewType.VIEW_TYPE_PROGRESS, |
| + ItemViewType.VIEW_TYPE_ACTION, |
| + ItemViewType.VIEW_TYPE_FOOTER, |
| + ItemViewType.VIEW_TYPE_PROMO, |
| + ItemViewType.VIEW_TYPE_ALL_DISMISSED |
| +}) |
| +@Retention(RetentionPolicy.SOURCE) |
| +public @interface ItemViewType { |
| + |
| + /** |
| + * View type for the above the fold item |
| + * |
| + * @see Adapter#getItemViewType(int) |
| + */ |
| + int VIEW_TYPE_ABOVE_THE_FOLD = 1; |
| + /** |
| + * View type for card group headers |
| + * |
| + * @see Adapter#getItemViewType(int) |
| + */ |
| + int VIEW_TYPE_HEADER = 2; |
| + /** |
| + * View type for snippet cards |
| + * |
| + * @see Adapter#getItemViewType(int) |
| + */ |
| + int VIEW_TYPE_SNIPPET = 3; |
| + /** |
| + * View type for a {@link SpacingItem} used to provide spacing at the end of the list. |
| + * |
| + * @see Adapter#getItemViewType(int) |
| + */ |
| + int VIEW_TYPE_SPACING = 4; |
| + /** |
| + * View type for a {@link StatusItem}, the card displaying status information |
| + * |
| + * @see Adapter#getItemViewType(int) |
| + */ |
| + int VIEW_TYPE_STATUS = 5; |
| + /** |
| + * View type for a {@link ProgressItem}, the progress indicator. |
| + * |
| + * @see Adapter#getItemViewType(int) |
| + */ |
| + int VIEW_TYPE_PROGRESS = 6; |
| + /** |
| + * View type for a {@link ActionItem}, an action button. |
| + * |
| + * @see Adapter#getItemViewType(int) |
| + */ |
| + int VIEW_TYPE_ACTION = 7; |
| + /** |
| + * View type for a {@link Footer}. |
| + * |
| + * @see Adapter#getItemViewType(int) |
| + */ |
| + int VIEW_TYPE_FOOTER = 8; |
| + /** |
| + * View type for a {@link SignInPromo}. |
| + * |
| + * @see Adapter#getItemViewType(int) |
| + */ |
| + int VIEW_TYPE_PROMO = 9; |
| + /** |
| + * View type for a {@link AllDismissedItem}. |
| + * |
| + * @see Adapter#getItemViewType(int) |
| + */ |
| + int VIEW_TYPE_ALL_DISMISSED = 10; |
| +} |