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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java

Issue 2725873003: 📰 Initialise suggestion cards favicon space (Closed)
Patch Set: always set the default favicon Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java
index 11e61a3ffcca9aeb17cfc7c261c74546ef125b9a..564b0e238d26c46b25ec560e2015080fe845416a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java
@@ -199,10 +199,13 @@ public void onBindViewHolder(SnippetArticle article, SuggestionsCategoryInfo cat
setThumbnail();
// Set the favicon of the publisher.
+ // We start initialising with the default favicon to reserve the space and prevent the text
+ // from moving later.
+ setDefaultFaviconOnView();
try {
fetchFaviconFromLocalCache(new URI(mArticle.mUrl), true);
} catch (URISyntaxException e) {
- setDefaultFaviconOnView();
+ // Do nothing, stick to the default favicon.
}
mOfflineBadge.setVisibility(View.GONE);
@@ -396,11 +399,12 @@ private void fetchFaviconFromLocalCache(final URI snippetUri, final boolean fall
getSnippetDomain(snippetUri), mPublisherFaviconSizePx, new FaviconImageCallback() {
@Override
public void onFaviconAvailable(Bitmap image, String iconUrl) {
- if (image == null && fallbackToService) {
+ if (image != null) {
+ setFaviconOnView(image);
+ } else if (fallbackToService) {
fetchFaviconFromService(snippetUri);
- return;
}
- setFaviconOnView(image);
+ // Else do nothing, we already have the placeholder set.
}
});
}
@@ -408,9 +412,6 @@ public void onFaviconAvailable(Bitmap image, String iconUrl) {
// TODO(crbug.com/635567): Fix this properly.
@SuppressLint("DefaultLocale")
private void fetchFaviconFromService(final URI snippetUri) {
- // Show the default favicon immediately.
- setDefaultFaviconOnView();
-
if (!mUseFaviconService) return;
int sizePx = getFaviconServiceSupportedSize();
if (sizePx == 0) return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698