From 87637eb299a4d66a490835279496d723c59155b1 Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Mon, 4 Nov 2013 11:48:57 -0800 Subject: [PATCH] Bug 931843 - Part 0: tidy up constants in TopSitesGridItemView. r=kats --- mobile/android/base/home/TopSitesGridItemView.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mobile/android/base/home/TopSitesGridItemView.java b/mobile/android/base/home/TopSitesGridItemView.java index 5b3b9cdb3f7..b7d998a4dca 100644 --- a/mobile/android/base/home/TopSitesGridItemView.java +++ b/mobile/android/base/home/TopSitesGridItemView.java @@ -30,6 +30,10 @@ public class TopSitesGridItemView extends RelativeLayout { // Empty state, to denote there is no valid url. private static final int[] STATE_EMPTY = { android.R.attr.state_empty }; + private static final ScaleType SCALE_TYPE_FAVICON = ScaleType.CENTER; + private static final ScaleType SCALE_TYPE_RESOURCE = ScaleType.CENTER; + private static final ScaleType SCALE_TYPE_THUMBNAIL = ScaleType.CENTER_CROP; + // Child views. private final TextView mTitleView; private final ImageView mThumbnailView; @@ -189,7 +193,7 @@ public class TopSitesGridItemView extends RelativeLayout { * @param resId Resource ID of the drawable to show. */ public void displayThumbnail(int resId) { - mThumbnailView.setScaleType(ScaleType.CENTER); + mThumbnailView.setScaleType(SCALE_TYPE_RESOURCE); mThumbnailView.setImageResource(resId); mThumbnailView.setBackgroundColor(0x0); } @@ -208,7 +212,7 @@ public class TopSitesGridItemView extends RelativeLayout { mThumbnail = thumbnail; Favicons.cancelFaviconLoad(mLoadId); - mThumbnailView.setScaleType(ScaleType.CENTER_CROP); + mThumbnailView.setScaleType(SCALE_TYPE_THUMBNAIL); mThumbnailView.setImageBitmap(thumbnail); mThumbnailView.setBackgroundDrawable(null); } @@ -245,7 +249,7 @@ public class TopSitesGridItemView extends RelativeLayout { mFaviconURL = faviconURL; } - mThumbnailView.setScaleType(ScaleType.CENTER); + mThumbnailView.setScaleType(SCALE_TYPE_FAVICON); mThumbnailView.setImageBitmap(favicon); if (mFaviconURL != null) {