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

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

Issue 2439763002: [Android NTP] Move getDismissSiblingPosDelta into the TreeNode interface. (Closed)
Patch Set: review Created 4 years, 2 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/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 ebad44ea6e30d2bf89d3dc9f47b0f2180b3a9760..9a4eaa2ab967de44516cbf5a09095fe4aad6c5a5 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
@@ -36,7 +36,7 @@ public class SuggestionsSection extends InnerNode {
}
@Override
- public List<TreeNode> getChildren() {
+ protected List<TreeNode> getChildren() {
return mChildren;
}
@@ -135,16 +135,7 @@ public class SuggestionsSection extends InnerNode {
}
}
- /**
- * The dismiss sibling is an item that should be dismissed at the same time as the provided
- * one. For example, if we want to dismiss a status card that has a More button attached, the
- * button is the card's dismiss sibling. This function return the adapter position delta to
- * apply to get to the sibling from the provided item. For the previous example, it would return
- * {@code +1}, as the button comes right after the status card.
- *
- * @return a position delta to apply to the position of the provided item to get the adapter
- * position of the item to animate. Returns {@code 0} if there is no dismiss sibling.
- */
+ @Override
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.
@@ -153,13 +144,13 @@ public class SuggestionsSection extends InnerNode {
// When there are suggestions we won't have contiguous status and action items.
if (hasSuggestions()) return 0;
- TreeNode item = getChildren().get(position);
+ TreeNode child = getChildForPosition(position);
// The sibling of the more button is the status card, that should be right above.
- if (item == mMoreButton) return -1;
+ if (child == mMoreButton) return -1;
// The sibling of the status card is the more button when it exists, should be right below.
- if (item == mStatus) return 1;
+ if (child == mStatus) return 1;
return 0;
}

Powered by Google App Engine
This is Rietveld 408576698