Misc attachment code cleanups

Change-Id: I612b3ed1280d4d057834d3d3e67c8ac17c2bafb6
diff --git a/res/layout-sw600dp/message_view_attachment.xml b/res/layout-sw600dp/message_view_attachment.xml
index 4763fac..0e679ad 100644
--- a/res/layout-sw600dp/message_view_attachment.xml
+++ b/res/layout-sw600dp/message_view_attachment.xml
@@ -99,55 +99,30 @@
             >
             <Button
                 android:id="@+id/load"
-                android:layout_width="0dip"
-                android:layout_weight="1"
-                android:layout_height="match_parent"
-                android:layout_marginLeft="16dip"
-                android:layout_marginRight="16dip"
                 style="@style/Attachment.Button"
                 android:text="@string/message_view_attachment_load_action"
                 android:visibility="gone"
                 />
             <Button
                 android:id="@+id/cancel"
-                android:layout_width="0dip"
-                android:layout_weight="1"
-                android:layout_height="match_parent"
-                android:layout_marginLeft="16dip"
-                android:layout_marginRight="16dip"
                 style="@style/Attachment.Button"
                 android:text="@string/message_view_attachment_cancel_action"
                 android:visibility="gone"
                 />
             <Button
                 android:id="@+id/info"
-                android:layout_width="0dip"
-                android:layout_weight="1"
-                android:layout_height="match_parent"
-                android:layout_marginLeft="16dip"
-                android:layout_marginRight="16dip"
                 style="@style/Attachment.Button"
                 android:text="@string/message_view_attachment_info_action"
                 android:visibility="gone"
                 />
             <Button
                 android:id="@+id/open"
-                android:layout_width="0dip"
-                android:layout_weight="1"
-                android:layout_height="match_parent"
-                android:layout_marginLeft="16dip"
-                android:layout_marginRight="16dip"
                 style="@style/Attachment.Button"
                 android:text="@string/message_view_attachment_view_action"
                 android:visibility="gone"
                 />
             <Button
                 android:id="@+id/save"
-                android:layout_width="0dip"
-                android:layout_weight="1"
-                android:layout_height="match_parent"
-                android:layout_marginLeft="16dip"
-                android:layout_marginRight="16dip"
                 style="@style/Attachment.Button"
                 android:text="@string/message_view_attachment_save_action"
                 android:visibility="gone"
diff --git a/res/layout/message_view_attachment.xml b/res/layout/message_view_attachment.xml
index aa6d0fe..f528a48 100644
--- a/res/layout/message_view_attachment.xml
+++ b/res/layout/message_view_attachment.xml
@@ -25,22 +25,40 @@
     android:layout_height="wrap_content"
     android:orientation="horizontal"
     >
-    <ImageView
-        android:id="@+id/attachment_icon"
-        android:layout_width="64dip"
-        android:layout_height="64dip"
-        android:src="@drawable/attached_image_placeholder"
-        />
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        >
+        <ProgressBar
+            android:id="@+id/progress"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:padding="0dip"
+            style="?android:attr/progressBarStyleHorizontal"
+            android:max="100"
+            android:visibility="invisible"
+            />
+        <ImageView
+            android:id="@+id/attachment_icon"
+            android:layout_width="48dip"
+            android:layout_height="48dip"
+            android:src="@drawable/attached_image_placeholder"
+            />
+    </LinearLayout>
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
+        android:paddingLeft="8dip"
+        android:paddingRight="8dip"
         android:orientation="vertical"
         >
         <TextView
             android:id="@+id/attachment_name"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textAppearance="?android:attr/textAppearanceSmall"
             android:textColor="?android:attr/textColorSecondaryInverse"
             android:singleLine="true"
             android:ellipsize="middle"
@@ -54,14 +72,6 @@
             android:singleLine="true"
             android:ellipsize="middle"
             />
-        <ProgressBar
-            android:id="@+id/progress"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            style="?android:attr/progressBarStyleHorizontal"
-            android:max="100"
-            android:visibility="invisible"
-            />
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
@@ -69,47 +79,32 @@
             >
             <Button
                 android:id="@+id/load"
-                android:layout_width="0dip"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
+                style="@style/Attachment.Button"
                 android:text="@string/message_view_attachment_load_action"
-                android:singleLine="true"
                 android:visibility="gone"
                 />
             <Button
                 android:id="@+id/cancel"
-                android:layout_width="0dip"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
+                style="@style/Attachment.Button"
                 android:text="@string/message_view_attachment_cancel_action"
-                android:singleLine="true"
                 android:visibility="gone"
                 />
             <Button
                 android:id="@+id/info"
-                android:layout_width="0dip"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
+                style="@style/Attachment.Button"
                 android:text="@string/message_view_attachment_info_action"
-                android:singleLine="true"
                 android:visibility="gone"
                 />
             <Button
                 android:id="@+id/save"
-                android:layout_width="0dip"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
+                style="@style/Attachment.Button"
                 android:text="@string/message_view_attachment_save_action"
-                android:singleLine="true"
                 android:visibility="gone"
                 />
             <Button
                 android:id="@+id/open"
-                android:layout_width="0dip"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
+                style="@style/Attachment.Button"
                 android:text="@string/message_view_attachment_view_action"
-                android:singleLine="true"
                 android:visibility="gone"
                 />
         </LinearLayout>
diff --git a/res/values-sw600dp/styles.xml b/res/values-sw600dp/styles.xml
index d383763..7c33fbc 100644
--- a/res/values-sw600dp/styles.xml
+++ b/res/values-sw600dp/styles.xml
@@ -132,4 +132,19 @@
     <style name="action_bar_spinner_secondary_text">
         <item name="android:visibility">gone</item>
     </style>
+
+    <style name="Attachment.Button" parent="@android:style/Widget.Holo.Button.Borderless">
+        <item name="android:layout_width">0dip</item>
+        <item name="android:layout_weight">1</item>
+        <item name="android:layout_height">match_parent</item>
+        <item name="android:layout_marginLeft">16dip</item>
+        <item name="android:layout_marginRight">16dip</item>
+        <item name="android:padding">0dip</item>
+        <item name="android:textColor">@color/buttontext</item>
+        <item name="android:textSize">14dip</item>
+        <item name="android:textStyle">bold</item>
+        <item name="android:singleLine">true</item>
+        <item name="android:ellipsize">end</item>
+        <item name="android:gravity">center</item>
+    </style>
 </resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 4877444..e55b22a 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -107,14 +107,16 @@
 
     <style name="Attachment" />
 
-    <style name="Attachment.Button" parent="@android:style/Widget.Holo.Button.Borderless">
-        <item name="android:padding">0dip</item>
+    <style name="Attachment.Button" parent="@android:style/Widget.Holo.Button">
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:layout_width">0dip</item>
+        <item name="android:layout_weight">1</item>
+        <item name="android:layout_gravity">center_vertical</item>
+        <item name="android:paddingTop">0dip</item>
+        <item name="android:paddingBottom">0dip</item>
+        <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
         <item name="android:textColor">@color/buttontext</item>
-        <item name="android:textSize">14dip</item>
-        <item name="android:textStyle">bold</item>
         <item name="android:singleLine">true</item>
-        <item name="android:ellipsize">end</item>
-        <item name="android:gravity">center</item>
     </style>
 
     <style name="SearchBar">
diff --git a/src/com/android/email/activity/MessageViewFragmentBase.java b/src/com/android/email/activity/MessageViewFragmentBase.java
index 7463a13..bd6b3fe 100644
--- a/src/com/android/email/activity/MessageViewFragmentBase.java
+++ b/src/com/android/email/activity/MessageViewFragmentBase.java
@@ -1525,7 +1525,7 @@
     }
 
     /**
-     * Reload the UI from a provider cursor.  {@link LoadMessageTask#onPostExecute} calls it.
+     * Reload the UI from a provider cursor.  {@link LoadMessageTask#onSuccess} calls it.
      *
      * Update the header views, and start loading the body.
      *