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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.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/NewTabPageAdapter.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java
index b316e77a766a5d66e213ea58d6cce3340c331d6e..c00cf332f8721018cf024b6ebf5eee8cfaddfeb2 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java
@@ -530,11 +530,7 @@ public class NewTabPageAdapter
*/
public ViewHolder getDismissSibling(ViewHolder viewHolder) {
int swipePos = viewHolder.getAdapterPosition();
- SuggestionsSection section = getSuggestionsSection(swipePos);
- if (section == null) return null;
-
- int siblingPosDelta =
- section.getDismissSiblingPosDelta(swipePos - getChildPositionOffset(section));
+ int siblingPosDelta = mRoot.getDismissSiblingPosDelta(swipePos);
if (siblingPosDelta == 0) return null;
return mRecyclerView.findViewHolderForAdapterPosition(siblingPosDelta + swipePos);
@@ -551,7 +547,7 @@ public class NewTabPageAdapter
*/
@VisibleForTesting
SuggestionsSection getSuggestionsSection(int itemPosition) {
- TreeNode child = mChildren.get(mRoot.getChildIndexForPosition(itemPosition));
+ TreeNode child = mRoot.getChildForPosition(itemPosition);
if (!(child instanceof SuggestionsSection)) return null;
return (SuggestionsSection) child;
}

Powered by Google App Engine
This is Rietveld 408576698