Bug 885821: Crop factor of thumbnails in BookmarksThumbnailView. [r=wesj]
authorSriram Ramasubramanian <sriram@mozilla.com>
Fri, 21 Jun 2013 16:57:24 -0700
changeset 143438 ff8eb6acf9e57ad0e4aa4e4cbdf6e74adceac672
parent 143437 2f186c2d4a411cf3a015d95379bff91f741be8f6
child 143439 db454c5472bfea1d93d85e35e782448a78e8a1b4
push id32723
push useremorley@mozilla.com
push dateWed, 21 Aug 2013 12:10:14 +0000
treeherdermozilla-inbound@ab6bc4d9e4c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs885821
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 885821: Crop factor of thumbnails in BookmarksThumbnailView. [r=wesj]
mobile/android/base/home/TopBookmarkItemView.java
mobile/android/base/resources/values/styles.xml
--- a/mobile/android/base/home/TopBookmarkItemView.java
+++ b/mobile/android/base/home/TopBookmarkItemView.java
@@ -16,16 +16,17 @@ import android.graphics.drawable.Drawabl
 import android.graphics.drawable.ShapeDrawable;
 import android.graphics.drawable.shapes.PathShape;
 import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
 import android.widget.ImageView;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
+import android.widget.ImageView.ScaleType;
 
 /**
  * A view that displays the thumbnail and the title/url for a bookmark.
  * If the title/url is longer than the width of the view, they are faded out.
  * If there is no valid url, a default string is shown at 50% opacity.
  * This is denoted by the empty state.
  */
 public class TopBookmarkItemView extends RelativeLayout {
@@ -138,16 +139,17 @@ public class TopBookmarkItemView extends
     }
 
     /**
      * Display the thumbnail from a resource.
      *
      * @param resId Resource ID of the drawable to show.
      */
     public void displayThumbnail(int resId) {
+        mThumbnailView.setScaleType(ScaleType.CENTER);
         mThumbnailView.setImageResource(resId);
         mThumbnailView.setBackgroundColor(0x0);
     }
 
     /**
      * Display the thumbnail from a bitmap.
      *
      * @param thumbnail The bitmap to show as thumbnail.
@@ -170,16 +172,17 @@ public class TopBookmarkItemView extends
      */
     public void displayFavicon(Bitmap favicon) {
         if (favicon == null) {
             // Should show default favicon.
             displayThumbnail(R.drawable.favicon);
             return;
         }
 
+        mThumbnailView.setScaleType(ScaleType.CENTER);
         mThumbnailView.setImageBitmap(favicon);
         mThumbnailView.setBackgroundColor(Favicons.getInstance().getFaviconColor(favicon, mUrl));
     }
 
     /**
      * Update the title shown by this view. If both title and url
      * are empty, mark the state as STATE_EMPTY and show a default text.
      */
--- a/mobile/android/base/resources/values/styles.xml
+++ b/mobile/android/base/resources/values/styles.xml
@@ -105,17 +105,17 @@
       <item name="android:layout_width">fill_parent</item>
       <item name="android:layout_height">fill_parent</item>
       <item name="android:padding">5dip</item>
       <item name="android:orientation">vertical</item>
     </style>
 
     <style name="Widget.BookmarkThumbnailView">
       <item name="android:padding">0dip</item>
-      <item name="android:scaleType">center</item>
+      <item name="android:scaleType">centerCrop</item>
     </style>
 
     <style name="Widget.TopBookmarkItemPin">
       <item name="android:minWidth">30dip</item>
       <item name="android:minHeight">30dip</item>
       <item name="android:padding">0dip</item>
     </style>