Bug 931843 - Part 3: don't retain thumbnails. r=bnicholson

This commit is contained in:
Richard Newman 2013-11-04 11:48:58 -08:00
parent 55808f7a19
commit b6c58c1c02
2 changed files with 5 additions and 12 deletions

View File

@ -43,7 +43,7 @@ public class TopSitesGridItemView extends RelativeLayout {
private String mUrl; private String mUrl;
private String mFaviconURL; private String mFaviconURL;
private Bitmap mThumbnail; private boolean mThumbnailSet;
// Pinned state. // Pinned state.
private boolean mIsPinned = false; private boolean mIsPinned = false;
@ -170,7 +170,7 @@ public class TopSitesGridItemView extends RelativeLayout {
} else if (changed) { } else if (changed) {
// Because we'll have a new favicon or thumbnail arriving shortly, and // Because we'll have a new favicon or thumbnail arriving shortly, and
// we need to not reject it because we already had a thumbnail. // we need to not reject it because we already had a thumbnail.
mThumbnail = null; mThumbnailSet = false;
} }
if (changed) { if (changed) {
@ -196,6 +196,7 @@ public class TopSitesGridItemView extends RelativeLayout {
mThumbnailView.setScaleType(SCALE_TYPE_RESOURCE); mThumbnailView.setScaleType(SCALE_TYPE_RESOURCE);
mThumbnailView.setImageResource(resId); mThumbnailView.setImageResource(resId);
mThumbnailView.setBackgroundColor(0x0); mThumbnailView.setBackgroundColor(0x0);
mThumbnailSet = false;
} }
/** /**
@ -209,7 +210,7 @@ public class TopSitesGridItemView extends RelativeLayout {
displayThumbnail(R.drawable.favicon); displayThumbnail(R.drawable.favicon);
return; return;
} }
mThumbnail = thumbnail; mThumbnailSet = true;
Favicons.cancelFaviconLoad(mLoadId); Favicons.cancelFaviconLoad(mLoadId);
mThumbnailView.setScaleType(SCALE_TYPE_THUMBNAIL); mThumbnailView.setScaleType(SCALE_TYPE_THUMBNAIL);
@ -234,7 +235,7 @@ public class TopSitesGridItemView extends RelativeLayout {
* @param favicon The favicon to show as thumbnail. * @param favicon The favicon to show as thumbnail.
*/ */
public void displayFavicon(Bitmap favicon, String faviconURL) { public void displayFavicon(Bitmap favicon, String faviconURL) {
if (mThumbnail != null) { if (mThumbnailSet) {
// Already showing a thumbnail; do nothing. // Already showing a thumbnail; do nothing.
return; return;
} }

View File

@ -141,14 +141,6 @@ public class TwoLinePageRow extends LinearLayout
mUrl.setCompoundDrawablesWithIntrinsicBounds(mUrlIconId, 0, mBookmarkIconId, 0); mUrl.setCompoundDrawablesWithIntrinsicBounds(mUrlIconId, 0, mBookmarkIconId, 0);
} }
private void setFaviconWithUrl(Bitmap favicon, String url) {
if (favicon == null) {
mFavicon.showDefaultFavicon();
} else {
mFavicon.updateImage(favicon, url);
}
}
private void setBookmarkIcon(int bookmarkIconId) { private void setBookmarkIcon(int bookmarkIconId) {
if (mBookmarkIconId == bookmarkIconId) { if (mBookmarkIconId == bookmarkIconId) {
return; return;