Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3619)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/StatusListItem.java

Issue 2024933002: [NTP Snippets] Show a status card when there are no available snippets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased and address comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/StatusListItem.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/StatusListItem.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/StatusListItem.java
new file mode 100644
index 0000000000000000000000000000000000000000..09737987930009275f81fbcefa2d48f7dac3e1bd
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/StatusListItem.java
@@ -0,0 +1,40 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.ntp.cards;
+
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+
+import org.chromium.chrome.R;
+
+/**
+ * Card that is shown when the user needs to be made aware of some information about their
+ * configuration about the NTP suggestions: there is no more available suggested content, sync
+ * should be enabled, etc.
+ */
+public class StatusListItem implements NewTabPageListItem {
+ /**
+ * ViewHolder for an item of type {@link #VIEW_TYPE_STATUS}.
+ */
+ public static class ViewHolder extends CardViewHolder {
+ public ViewHolder(NewTabPageRecyclerView parent, final NewTabPageAdapter adapter) {
+ super(R.layout.new_tab_page_status_card, parent);
+ Button reloadButton = ((Button) itemView.findViewById(R.id.reload_button));
+ reloadButton.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ adapter.reloadSnippets();
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getType() {
+ return NewTabPageListItem.VIEW_TYPE_STATUS;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698