OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.ntp.cards; |
| 6 |
| 7 import org.chromium.chrome.browser.ntp.snippets.SnippetArticle; |
| 8 |
| 9 /** |
| 10 * A tree interface to allow the New Tab Page RecyclerView to delegate to other
components. |
| 11 */ |
| 12 interface TreeNode { |
| 13 /** |
| 14 * @return The number of items under this subtree. |
| 15 * @see android.support.v7.widget.RecyclerView.Adapter#getItemCount() |
| 16 */ |
| 17 int getItemCount(); |
| 18 |
| 19 /** |
| 20 * @param position The position to query |
| 21 * @return The view type of the item at {@code position} under this subtree. |
| 22 * @see android.support.v7.widget.RecyclerView.Adapter#getItemViewType |
| 23 */ |
| 24 @ItemViewType |
| 25 int getItemViewType(int position); |
| 26 |
| 27 /** |
| 28 * Display the data at {@code position} under this subtree. |
| 29 * @param holder The view holder that should be updated. |
| 30 * @param position The position of the item under this subtree. |
| 31 * @see android.support.v7.widget.RecyclerView.Adapter#onBindViewHolder |
| 32 */ |
| 33 void onBindViewHolder(NewTabPageViewHolder holder, final int position); |
| 34 |
| 35 /** |
| 36 * @param position The position to query. |
| 37 * @return The article at {@code position} under this subtree, or null if th
e item is not |
| 38 * an article. |
| 39 */ |
| 40 SnippetArticle getSuggestionAt(int position); |
| 41 } |
OLD | NEW |