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.IntegerRes; | 8 import android.support.annotation.IntegerRes; |
9 import android.support.annotation.StringRes; | 9 import android.support.annotation.StringRes; |
10 import android.view.View; | 10 import android.view.View; |
11 import android.widget.Button; | 11 import android.widget.Button; |
12 import android.widget.TextView; | 12 import android.widget.TextView; |
13 | 13 |
14 import org.chromium.chrome.R; | 14 import org.chromium.chrome.R; |
15 import org.chromium.chrome.browser.ntp.ContextMenuManager; | 15 import org.chromium.chrome.browser.ntp.ContextMenuManager; |
16 import org.chromium.chrome.browser.ntp.ContextMenuManager.ContextMenuItemId; | 16 import org.chromium.chrome.browser.ntp.ContextMenuManager.ContextMenuItemId; |
17 import org.chromium.chrome.browser.ntp.ContextMenuManager.Delegate; | 17 import org.chromium.chrome.browser.ntp.ContextMenuManager.Delegate; |
18 import org.chromium.chrome.browser.ntp.NewTabPageView.NewTabPageManager; | |
19 import org.chromium.chrome.browser.ntp.UiConfig; | 18 import org.chromium.chrome.browser.ntp.UiConfig; |
20 import org.chromium.chrome.browser.ntp.snippets.SnippetsConfig; | 19 import org.chromium.chrome.browser.ntp.snippets.SnippetsConfig; |
21 | 20 |
22 /** | 21 /** |
23 * ViewHolder for Status and Promo cards. | 22 * ViewHolder for Status and Promo cards. |
24 */ | 23 */ |
25 public class StatusCardViewHolder extends CardViewHolder implements ContextMenuM
anager.Delegate { | 24 public class StatusCardViewHolder extends CardViewHolder implements ContextMenuM
anager.Delegate { |
26 private final TextView mTitleView; | 25 private final TextView mTitleView; |
27 private final TextView mBodyView; | 26 private final TextView mBodyView; |
28 private final Button mActionView; | 27 private final Button mActionView; |
29 | 28 |
30 public StatusCardViewHolder( | 29 public StatusCardViewHolder( |
31 NewTabPageRecyclerView parent, NewTabPageManager newTabPageManager,
UiConfig config) { | 30 NewTabPageRecyclerView parent, ContextMenuManager contextMenuManager
, UiConfig config) { |
32 super(R.layout.new_tab_page_status_card, parent, config, newTabPageManag
er); | 31 super(R.layout.new_tab_page_status_card, parent, config, contextMenuMana
ger); |
33 mTitleView = (TextView) itemView.findViewById(R.id.status_title); | 32 mTitleView = (TextView) itemView.findViewById(R.id.status_title); |
34 mBodyView = (TextView) itemView.findViewById(R.id.status_body); | 33 mBodyView = (TextView) itemView.findViewById(R.id.status_body); |
35 mActionView = (Button) itemView.findViewById(R.id.status_action_button); | 34 mActionView = (Button) itemView.findViewById(R.id.status_action_button); |
36 } | 35 } |
37 | 36 |
38 /** | 37 /** |
39 * Interface for data items that will be shown in this card. | 38 * Interface for data items that will be shown in this card. |
40 */ | 39 */ |
41 public interface DataSource { | 40 public interface DataSource { |
42 /** | 41 /** |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 112 } |
114 | 113 |
115 @Override | 114 @Override |
116 public void onContextMenuCreated() {} | 115 public void onContextMenuCreated() {} |
117 | 116 |
118 @Override | 117 @Override |
119 public boolean isDismissable() { | 118 public boolean isDismissable() { |
120 return SnippetsConfig.isSectionDismissalEnabled(); | 119 return SnippetsConfig.isSectionDismissalEnabled(); |
121 } | 120 } |
122 } | 121 } |
OLD | NEW |