| 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.StringRes; | 7 import android.support.annotation.StringRes; |
| 8 import android.view.LayoutInflater; | 8 import android.view.LayoutInflater; |
| 9 import android.view.View; | 9 import android.view.View; |
| 10 import android.view.View.OnClickListener; | 10 import android.view.View.OnClickListener; |
| 11 import android.view.ViewGroup; | 11 import android.view.ViewGroup; |
| 12 import android.widget.Button; | 12 import android.widget.Button; |
| 13 import android.widget.TextView; | 13 import android.widget.TextView; |
| 14 | 14 |
| 15 import org.chromium.chrome.R; | 15 import org.chromium.chrome.R; |
| 16 import org.chromium.chrome.browser.ntp.NewTabPageUma; | 16 import org.chromium.chrome.browser.ntp.NewTabPageUma; |
| 17 import org.chromium.chrome.browser.ntp.NewTabPageView.NewTabPageManager; | 17 import org.chromium.chrome.browser.ntp.NewTabPageView.NewTabPageManager; |
| 18 | 18 |
| 19 import java.util.Calendar; | 19 import java.util.Calendar; |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 * Displayed when all suggested content and their sections have been dismissed.
Provides a button | 22 * Displayed when all suggested content and their sections have been dismissed.
Provides a button |
| 23 * to restore the dismissed sections and load new suggestions from the server. | 23 * to restore the dismissed sections and load new suggestions from the server. |
| 24 */ | 24 */ |
| 25 public class AllDismissedItem extends SingleItemGroup { | 25 public class AllDismissedItem extends Leaf { |
| 26 @Override | 26 @Override |
| 27 public int getType() { | 27 @ItemViewType |
| 28 return NewTabPageItem.VIEW_TYPE_ALL_DISMISSED; | 28 public int getItemViewType() { |
| 29 return ItemViewType.ALL_DISMISSED; |
| 29 } | 30 } |
| 30 | 31 |
| 31 @Override | 32 @Override |
| 32 public void onBindViewHolder(NewTabPageViewHolder holder) { | 33 public void onBindViewHolder(NewTabPageViewHolder holder) { |
| 33 assert holder instanceof ViewHolder; | 34 assert holder instanceof ViewHolder; |
| 34 ((ViewHolder) holder).onBindViewHolder(); | 35 ((ViewHolder) holder).onBindViewHolder(); |
| 35 } | 36 } |
| 36 | 37 |
| 37 /** | 38 /** |
| 38 * ViewHolder for an item of type {@link #VIEW_TYPE_ALL_DISMISSED}. | 39 * ViewHolder for an item of type {@link ItemViewType#ALL_DISMISSED}. |
| 39 */ | 40 */ |
| 40 public static class ViewHolder extends NewTabPageViewHolder { | 41 public static class ViewHolder extends NewTabPageViewHolder { |
| 41 private final TextView mBodyTextView; | 42 private final TextView mBodyTextView; |
| 42 | 43 |
| 43 public ViewHolder( | 44 public ViewHolder( |
| 44 ViewGroup root, final NewTabPageManager manager, final NewTabPag
eAdapter adapter) { | 45 ViewGroup root, final NewTabPageManager manager, final NewTabPag
eAdapter adapter) { |
| 45 super(LayoutInflater.from(root.getContext()) | 46 super(LayoutInflater.from(root.getContext()) |
| 46 .inflate(R.layout.new_tab_page_all_dismissed, root,
false)); | 47 .inflate(R.layout.new_tab_page_all_dismissed, root,
false)); |
| 47 mBodyTextView = (TextView) itemView.findViewById(R.id.body_text); | 48 mBodyTextView = (TextView) itemView.findViewById(R.id.body_text); |
| 48 | 49 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 67 messageId = R.string.ntp_all_dismissed_body_text_morning; | 68 messageId = R.string.ntp_all_dismissed_body_text_morning; |
| 68 } else if (hour >= 12 && hour < 17) { | 69 } else if (hour >= 12 && hour < 17) { |
| 69 messageId = R.string.ntp_all_dismissed_body_text_afternoon; | 70 messageId = R.string.ntp_all_dismissed_body_text_afternoon; |
| 70 } else { | 71 } else { |
| 71 messageId = R.string.ntp_all_dismissed_body_text_evening; | 72 messageId = R.string.ntp_all_dismissed_body_text_evening; |
| 72 } | 73 } |
| 73 mBodyTextView.setText(messageId); | 74 mBodyTextView.setText(messageId); |
| 74 } | 75 } |
| 75 } | 76 } |
| 76 } | 77 } |
| OLD | NEW |