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 org.chromium.base.Callback; | 7 import org.chromium.base.Callback; |
8 import org.chromium.chrome.browser.ntp.snippets.SnippetArticle; | |
9 | 8 |
10 import java.util.Collections; | 9 import java.util.Collections; |
11 import java.util.Set; | 10 import java.util.Set; |
12 | 11 |
13 /** | 12 /** |
14 * A permanent leaf in the tree, i.e. a single item. | 13 * A permanent leaf in the tree, i.e. a single item. |
15 * If the leaf is not to be a permanent member of the tree, see {@link OptionalL
eaf} for an | 14 * If the leaf is not to be a permanent member of the tree, see {@link OptionalL
eaf} for an |
16 * implementation that will take care of hiding or showing the item. | 15 * implementation that will take care of hiding or showing the item. |
17 */ | 16 */ |
18 public abstract class Leaf extends ChildNode { | 17 public abstract class Leaf extends ChildNode { |
(...skipping 15 matching lines...) Expand all Loading... |
34 return getItemViewType(); | 33 return getItemViewType(); |
35 } | 34 } |
36 | 35 |
37 @Override | 36 @Override |
38 public void onBindViewHolder(NewTabPageViewHolder holder, int position) { | 37 public void onBindViewHolder(NewTabPageViewHolder holder, int position) { |
39 if (position != 0) throw new IndexOutOfBoundsException(); | 38 if (position != 0) throw new IndexOutOfBoundsException(); |
40 onBindViewHolder(holder); | 39 onBindViewHolder(holder); |
41 } | 40 } |
42 | 41 |
43 @Override | 42 @Override |
44 public SnippetArticle getSuggestionAt(int position) { | |
45 if (position != 0) throw new IndexOutOfBoundsException(); | |
46 | |
47 return null; | |
48 } | |
49 | |
50 @Override | |
51 public Set<Integer> getItemDismissalGroup(int position) { | 43 public Set<Integer> getItemDismissalGroup(int position) { |
52 return Collections.emptySet(); | 44 return Collections.emptySet(); |
53 } | 45 } |
54 | 46 |
55 @Override | 47 @Override |
56 public void dismissItem(int position, Callback<String> itemRemovedCallback)
{ | 48 public void dismissItem(int position, Callback<String> itemRemovedCallback)
{ |
57 assert false; | 49 assert false; |
58 } | 50 } |
59 | 51 |
60 /** | 52 /** |
61 * Display the data for this item. | 53 * Display the data for this item. |
62 * @param holder The view holder that should be updated. | 54 * @param holder The view holder that should be updated. |
63 * @see #onBindViewHolder(NewTabPageViewHolder, int) | 55 * @see #onBindViewHolder(NewTabPageViewHolder, int) |
64 * @see android.support.v7.widget.RecyclerView.Adapter#onBindViewHolder | 56 * @see android.support.v7.widget.RecyclerView.Adapter#onBindViewHolder |
65 */ | 57 */ |
66 protected abstract void onBindViewHolder(NewTabPageViewHolder holder); | 58 protected abstract void onBindViewHolder(NewTabPageViewHolder holder); |
67 | 59 |
68 /** | 60 /** |
69 * @return The view type of this item. | 61 * @return The view type of this item. |
70 * @see android.support.v7.widget.RecyclerView.Adapter#getItemViewType | 62 * @see android.support.v7.widget.RecyclerView.Adapter#getItemViewType |
71 */ | 63 */ |
72 @ItemViewType | 64 @ItemViewType |
73 protected abstract int getItemViewType(); | 65 protected abstract int getItemViewType(); |
74 } | 66 } |
OLD | NEW |