| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.ntp.cards; | 5 package org.chromium.chrome.browser.ntp.cards; |
| 6 | 6 |
| 7 import android.support.annotation.CallSuper; |
| 8 |
| 7 import org.chromium.chrome.browser.ntp.snippets.SnippetArticle; | 9 import org.chromium.chrome.browser.ntp.snippets.SnippetArticle; |
| 8 | 10 |
| 9 /** | 11 /** |
| 10 * A tree interface to allow the New Tab Page RecyclerView to delegate to other
components. | 12 * A tree interface to allow the New Tab Page RecyclerView to delegate to other
components. |
| 11 */ | 13 */ |
| 12 interface TreeNode { | 14 interface TreeNode { |
| 13 /** | 15 /** |
| 16 * Initialize the node (and any children underneath it). This method should
be called after the |
| 17 * node has been added to the tree, i.e. when it is in the list of its paren
t's children. |
| 18 * The node may notify its parent about changes that happen during initializ
ation. |
| 19 */ |
| 20 @CallSuper |
| 21 void init(); |
| 22 |
| 23 /** |
| 24 * Returns the number of items under this subtree. This method may be called |
| 25 * before initialization. |
| 26 * |
| 14 * @return The number of items under this subtree. | 27 * @return The number of items under this subtree. |
| 15 * @see android.support.v7.widget.RecyclerView.Adapter#getItemCount() | 28 * @see android.support.v7.widget.RecyclerView.Adapter#getItemCount() |
| 16 */ | 29 */ |
| 17 int getItemCount(); | 30 int getItemCount(); |
| 18 | 31 |
| 19 /** | 32 /** |
| 20 * @param position The position to query | 33 * @param position The position to query |
| 21 * @return The view type of the item at {@code position} under this subtree. | 34 * @return The view type of the item at {@code position} under this subtree. |
| 22 * @see android.support.v7.widget.RecyclerView.Adapter#getItemViewType | 35 * @see android.support.v7.widget.RecyclerView.Adapter#getItemViewType |
| 23 */ | 36 */ |
| (...skipping 20 matching lines...) Expand all Loading... |
| 44 * one. For example, if we want to dismiss a status card that has a More but
ton attached, the | 57 * one. For example, if we want to dismiss a status card that has a More but
ton attached, the |
| 45 * button is the card's dismiss sibling. This function returns the adapter p
osition delta to | 58 * button is the card's dismiss sibling. This function returns the adapter p
osition delta to |
| 46 * apply to get to the sibling from the provided item. For the previous exam
ple, it would return | 59 * apply to get to the sibling from the provided item. For the previous exam
ple, it would return |
| 47 * {@code +1}, as the button comes right after the status card. | 60 * {@code +1}, as the button comes right after the status card. |
| 48 * | 61 * |
| 49 * @return a position delta to apply to the position of the provided item to
get the adapter | 62 * @return a position delta to apply to the position of the provided item to
get the adapter |
| 50 * position of the item to animate. Returns {@code 0} if there is no dismiss
sibling. | 63 * position of the item to animate. Returns {@code 0} if there is no dismiss
sibling. |
| 51 */ | 64 */ |
| 52 int getDismissSiblingPosDelta(int position); | 65 int getDismissSiblingPosDelta(int position); |
| 53 } | 66 } |
| OLD | NEW |