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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/InnerNode.java

Issue 2513453004: [Android NTP] Move suggestion sections into a separate node. (Closed)
Patch Set: sync Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.ntp.cards; 5 package org.chromium.chrome.browser.ntp.cards;
6 6
7 import org.chromium.chrome.browser.ntp.snippets.SnippetArticle; 7 import org.chromium.chrome.browser.ntp.snippets.SnippetArticle;
8 8
9 import java.util.List; 9 import java.util.List;
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 @Override 102 @Override
103 public void onItemRangeInserted(TreeNode child, int index, int count) { 103 public void onItemRangeInserted(TreeNode child, int index, int count) {
104 notifyItemRangeInserted(getStartingOffsetForChild(child) + index, count) ; 104 notifyItemRangeInserted(getStartingOffsetForChild(child) + index, count) ;
105 } 105 }
106 106
107 @Override 107 @Override
108 public void onItemRangeRemoved(TreeNode child, int index, int count) { 108 public void onItemRangeRemoved(TreeNode child, int index, int count) {
109 notifyItemRangeRemoved(getStartingOffsetForChild(child) + index, count); 109 notifyItemRangeRemoved(getStartingOffsetForChild(child) + index, count);
110 } 110 }
111
112 @Override
113 public void init() {
114 super.init();
115 for (TreeNode child : getChildren()) {
116 child.init();
117 }
118 }
119
120 /**
121 * Helper method for adding a new child node. Notifies about the inserted it ems and initializes
122 * the child.
123 *
124 * @param child The child node to be added.
125 */
126 protected void didAddChild(TreeNode child) {
127 int count = child.getItemCount();
128 if (count > 0) onItemRangeInserted(child, 0, count);
129 child.init();
130 }
131
132 /**
133 * Helper method for removing a child node. Notifies about the removed items .
134 *
135 * @param child The child node to be removed.
136 */
137 protected void willRemoveChild(TreeNode child) {
138 int count = child.getItemCount();
139 if (count > 0) onItemRangeRemoved(child, 0, count);
140 }
111 } 141 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698