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

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

Issue 2617133002: [Android NTP] Move more of the dismissal logic into the tree. (Closed)
Patch Set: annotation Created 3 years, 11 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/TreeNode.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/TreeNode.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/TreeNode.java
index c08736cf9f1899e088456d66660f528101880afc..7a13f6f5eb3e019a21e092e77ea758ad399be93c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/TreeNode.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/TreeNode.java
@@ -7,14 +7,16 @@ package org.chromium.chrome.browser.ntp.cards;
import org.chromium.base.Callback;
import org.chromium.chrome.browser.ntp.snippets.SnippetArticle;
+import java.util.Set;
+
/**
* A tree interface to allow the New Tab Page RecyclerView to delegate to other components.
*/
interface TreeNode {
/**
- * Initialize the node (and any children underneath it). This method should be called after the
- * node has been added to the tree, i.e. when it is in the list of its parent's children.
- * The node may notify its parent about changes that happen during initialization.
+ * Sets the parent of this node. This method should be called at most once. Before the parent
+ * has been set, the node will not send any notifications about changes to its subtree.
+ * @param parent the parent of this node.
*/
void setParent(NodeParent parent);
@@ -51,22 +53,20 @@ interface TreeNode {
SnippetArticle getSuggestionAt(int position);
/**
+ * @param position the position of an item to be dismissed.
+ * @return the set of item positions that should be dismissed simultaneously when dismissing the
+ * item at the given {@code position} (including the position itself), or an empty set
+ * if the item can't be dismissed.
+ * @see NewTabPageAdapter#getItemDismissalGroup
+ */
+ Set<Integer> getItemDismissalGroup(int position);
+
+ /**
* Dismiss the item at the given {@code position}.
* @param position The position of the item to be dismissed.
* @param itemRemovedCallback Should be called with the title of the dismissed item, to announce
* it for accessibility purposes.
+ * @see NewTabPageAdapter#dismissItem
*/
public void dismissItem(int position, Callback<String> itemRemovedCallback);
-
- /**
- * 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 returns 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.
- */
- int getDismissSiblingPosDelta(int position);
}

Powered by Google App Engine
This is Rietveld 408576698