Fixed a bug where thumbnails wouldn't show.

Also improved the scaling of thumbnail images and
added a black background. Need new icon for non-images.

Change-Id: I8f5a5df85dce3a3e331cd343171869fcb99f311f
diff --git a/res/layout/conversation_message_attachment.xml b/res/layout/conversation_message_attachment.xml
index e60ea5a..b8304ea 100644
--- a/res/layout/conversation_message_attachment.xml
+++ b/res/layout/conversation_message_attachment.xml
@@ -24,7 +24,7 @@
     android:orientation="vertical"
     android:divider="?android:attr/dividerHorizontal"
     android:showDividers="middle"
-    android:background="@drawable/attachment_bg_holo">
+    android:background="@android:color/black">
 
     <RelativeLayout
         android:id="@+id/attachment_tile_layout"
@@ -35,7 +35,7 @@
             android:id="@+id/attachment_tile_image"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:scaleType="centerCrop" />
+            android:scaleType="fitCenter" />
 
         <RelativeLayout
             android:layout_width="match_parent"
diff --git a/src/com/android/mail/browse/MessageAttachmentTile.java b/src/com/android/mail/browse/MessageAttachmentTile.java
index be86463..613e6f6 100644
--- a/src/com/android/mail/browse/MessageAttachmentTile.java
+++ b/src/com/android/mail/browse/MessageAttachmentTile.java
@@ -140,12 +140,6 @@
                 }
 
                 opts.inJustDecodeBounds = false;
-                // Shrink both X and Y (but do not over-shrink)
-                // and pick the least affected dimension to ensure the thumbnail is fillable
-                // (i.e. ScaleType.CENTER_CROP)
-                final int wDivider = Math.max(opts.outWidth / mWidth, 1);
-                final int hDivider = Math.max(opts.outHeight / mHeight, 1);
-                opts.inSampleSize = Math.min(wDivider, hDivider);
 
                 LogUtils.d(LOG_TAG, "in background, src w/h=%d/%d dst w/h=%d/%d, divider=%d",
                         opts.outWidth, opts.outHeight, mWidth, mHeight, opts.inSampleSize);
@@ -243,7 +237,7 @@
             }
             mThumbnailTask = new ThumbnailLoadTask(mIcon.getWidth(), mIcon.getHeight());
             mThumbnailTask.execute(imageUri);
-        } else {
+        } else if (imageUri == null) {
             // not an image, or no thumbnail exists. fall back to default.
             // async image load must separately ensure the default appears upon load failure.
             setThumbnailToDefault();