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

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

Issue 2470913009: 📰 Refactor SuggestionsSection change detection (Closed)
Patch Set: address comments Created 4 years, 1 month 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/StatusItem.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/StatusItem.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/StatusItem.java
index 83e33fad1fc28b8ce0c8189c40244023fc3f299b..1c684de87cb65c57e9c9b7b0f14ca6c971080b89 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/StatusItem.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/StatusItem.java
@@ -13,16 +13,21 @@
* Card that is shown when the user needs to be made aware of some information about their
* configuration that affects the NTP suggestions.
*/
-public abstract class StatusItem extends Leaf implements StatusCardViewHolder.DataSource {
- public static StatusItem createNoSuggestionsItem(SuggestionsCategoryInfo categoryInfo) {
- return new NoSuggestionsItem(categoryInfo);
+public abstract class StatusItem extends OptionalLeaf implements StatusCardViewHolder.DataSource {
+
+ protected StatusItem(NodeParent parent) {
+ super(parent);
}
- private static class NoSuggestionsItem extends StatusItem {
- private final SuggestionsCategoryInfo mCategoryInfo;
+ public static StatusItem createNoSuggestionsItem(SuggestionsSection parentSection) {
+ return new NoSuggestionsItem(parentSection);
+ }
- public NoSuggestionsItem(SuggestionsCategoryInfo info) {
- mCategoryInfo = info;
+ private static class NoSuggestionsItem extends StatusItem {
+ private final String mDescription;
+ public NoSuggestionsItem(SuggestionsSection parentSection) {
+ super(parentSection);
+ mDescription = parentSection.getCategoryInfo().getNoSuggestionsMessage();
}
@Override
@@ -33,7 +38,7 @@ public int getHeader() {
@Override
public String getDescription() {
- return mCategoryInfo.getNoSuggestionsMessage();
+ return mDescription;
}
@Override

Powered by Google App Engine
This is Rietveld 408576698