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.content.Context; | 7 import android.content.Context; |
8 import android.support.annotation.StringRes; | 8 import android.support.annotation.StringRes; |
9 | 9 |
10 import org.chromium.chrome.R; | 10 import org.chromium.chrome.R; |
11 | 11 |
12 /** | 12 /** |
13 * Card that is shown when the user needs to be made aware of some information a
bout their | 13 * Card that is shown when the user needs to be made aware of some information a
bout their |
14 * configuration that affects the NTP suggestions. | 14 * configuration that affects the NTP suggestions. |
15 */ | 15 */ |
16 public abstract class StatusItem implements NewTabPageItem, StatusCardViewHolder
.DataSource { | 16 public abstract class StatusItem extends Leaf implements StatusCardViewHolder.Da
taSource { |
17 public static StatusItem createNoSuggestionsItem(SuggestionsCategoryInfo cat
egoryInfo) { | 17 public static StatusItem createNoSuggestionsItem(SuggestionsCategoryInfo cat
egoryInfo) { |
18 return new NoSuggestionsItem(categoryInfo); | 18 return new NoSuggestionsItem(categoryInfo); |
19 } | 19 } |
20 | 20 |
21 private static class NoSuggestionsItem extends StatusItem { | 21 private static class NoSuggestionsItem extends StatusItem { |
22 private final SuggestionsCategoryInfo mCategoryInfo; | 22 private final SuggestionsCategoryInfo mCategoryInfo; |
23 | 23 |
24 public NoSuggestionsItem(SuggestionsCategoryInfo info) { | 24 public NoSuggestionsItem(SuggestionsCategoryInfo info) { |
25 mCategoryInfo = info; | 25 mCategoryInfo = info; |
26 } | 26 } |
(...skipping 16 matching lines...) Expand all Loading... |
43 return 0; | 43 return 0; |
44 } | 44 } |
45 | 45 |
46 @Override | 46 @Override |
47 public void performAction(Context context) { | 47 public void performAction(Context context) { |
48 assert false; | 48 assert false; |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 @Override | 52 @Override |
53 public int getType() { | 53 @ItemViewType |
54 return NewTabPageItem.VIEW_TYPE_STATUS; | 54 protected int getItemViewType() { |
| 55 return ItemViewType.STATUS; |
55 } | 56 } |
56 | 57 |
57 @Override | 58 @Override |
58 public void onBindViewHolder(NewTabPageViewHolder holder) { | 59 protected void onBindViewHolder(NewTabPageViewHolder holder) { |
59 assert holder instanceof StatusCardViewHolder; | 60 assert holder instanceof StatusCardViewHolder; |
60 ((StatusCardViewHolder) holder).onBindViewHolder(this); | 61 ((StatusCardViewHolder) holder).onBindViewHolder(this); |
61 } | 62 } |
62 } | 63 } |
OLD | NEW |