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

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

Issue 2463133002: 📰 Make the MORE button more configurable (Closed)
Patch Set: rebase 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/SuggestionsSection.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java
index d6876af7d88637b616512c53e57b6f02ecc4cf0c..4673435cd6323327426ac7fe6ee66916387b6874 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java
@@ -43,7 +43,7 @@ public SuggestionsSection(NodeParent parent, SuggestionsCategoryInfo info,
super(parent);
mHeader = new SectionHeader(info.getTitle());
mCategoryInfo = info;
- mMoreButton = new ActionItem(info);
+ mMoreButton = new ActionItem(info, this);
mStatus = StatusItem.createNoSuggestionsItem(info);
resetChildren();
@@ -108,7 +108,7 @@ private void resetChildren() {
mChildren.add(mSuggestionsList);
if (mSuggestions.isEmpty()) mChildren.add(mStatus);
- if (mCategoryInfo.hasMoreButton() || mSuggestions.isEmpty()) mChildren.add(mMoreButton);
+ mChildren.add(mMoreButton);
if (mSuggestions.isEmpty()) mChildren.add(mProgressIndicator);
}
@@ -117,7 +117,6 @@ public void removeSuggestion(SnippetArticle suggestion) {
if (removedIndex == -1) return;
mSuggestions.remove(removedIndex);
- if (mMoreButton != null) mMoreButton.setDismissable(!hasSuggestions());
resetChildren();
@@ -159,10 +158,6 @@ public void setSuggestions(List<SnippetArticle> suggestions, @CategoryStatusEnum
markSnippetsAvailableOffline();
- if (mMoreButton != null) {
- mMoreButton.setPosition(mSuggestions.size());
- mMoreButton.setDismissable(mSuggestions.isEmpty());
- }
resetChildren();
notifySectionChanged(itemCountBefore);
}
@@ -221,7 +216,7 @@ private void copyThumbnails(List<SnippetArticle> suggestions) {
public int getDismissSiblingPosDelta(int position) {
// The only dismiss siblings we have so far are the More button and the status card.
// Exit early if there is no More button.
- if (mMoreButton == null) return 0;
+ if (!mMoreButton.isShown()) return 0;
// When there are suggestions we won't have contiguous status and action items.
if (hasSuggestions()) return 0;

Powered by Google App Engine
This is Rietveld 408576698