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

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

Issue 2665983005: Ntp: use callbacks for partial binding, they can carry more detail. (Closed)
Patch Set: Address review comments from bauerb. 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/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 e5bebb4f24884d01431750512bbff7cfee68a948..0b0ed0ec58ec9a4dce1b61cb4dfe394f1aa607f7 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
@@ -19,7 +19,6 @@ import org.chromium.chrome.browser.ntp.snippets.SuggestionsSource;
import org.chromium.chrome.browser.offlinepages.ClientId;
import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
import org.chromium.chrome.browser.offlinepages.OfflinePageItem;
-import org.chromium.chrome.browser.suggestions.PartialUpdateId;
import org.chromium.chrome.browser.suggestions.SuggestionsRanker;
import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegate;
@@ -229,7 +228,8 @@ public class SuggestionsSection extends InnerNode {
article.setOfflinePageOfflineId(newId);
if ((oldId == null) == (newId == null)) return;
- notifyItemChanged(index, PartialUpdateId.OFFLINE_BADGE);
+ notifyItemChanged(
+ index, SnippetArticleViewHolder.REFRESH_OFFLINE_BADGE_VISIBILITY_CALLBACK);
}
}
@@ -276,9 +276,13 @@ public class SuggestionsSection extends InnerNode {
/** Sends a notification to the items at the provided indices to refresh their background. */
private void notifyNeighboursModified(int aboveNeighbour, int belowNeighbour) {
assert aboveNeighbour < belowNeighbour;
- if (aboveNeighbour >= 0) notifyItemChanged(aboveNeighbour, PartialUpdateId.CARD_BACKGROUND);
+
+ if (aboveNeighbour >= 0) {
+ notifyItemChanged(aboveNeighbour, NewTabPageViewHolder.UPDATE_LAYOUT_PARAMS_CALLBACK);
+ }
+
if (belowNeighbour < getItemCount()) {
- notifyItemChanged(belowNeighbour, PartialUpdateId.CARD_BACKGROUND);
+ notifyItemChanged(belowNeighbour, NewTabPageViewHolder.UPDATE_LAYOUT_PARAMS_CALLBACK);
}
}

Powered by Google App Engine
This is Rietveld 408576698