Merge "Fix typo in loading thumbnail" into ub-gmail-ur14-dev
diff --git a/res/layout/custom_from_item.xml b/res/layout/custom_from_item.xml
deleted file mode 100644
index c793142..0000000
--- a/res/layout/custom_from_item.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     Copyright (C) 2011 Google Inc.
-     Licensed to The Android Open Source Project.
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent">
-
-    <TextView
-        android:id="@+id/spinner_account_name"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:textAlignment="viewStart"
-        style="@style/ComposeFromTextViewStyle" />
-
-    <TextView
-        android:id="@+id/spinner_account_address"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_weight="1"
-        android:textAlignment="viewStart"
-        style="@style/SpinnerAccountAddressStyle" />
-
-    <ImageView
-        android:src="@drawable/ic_expand_more_24dp"
-        style="@style/ComposeFieldButton" />
-
-</LinearLayout>
diff --git a/res/layout/from_item.xml b/res/layout/from_item.xml
index 027d1a6..b20e9a3 100644
--- a/res/layout/from_item.xml
+++ b/res/layout/from_item.xml
@@ -20,11 +20,17 @@
     android:layout_height="match_parent">
 
     <TextView
+        android:id="@+id/spinner_account_name"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textAlignment="viewStart"
+        style="@style/SpinnerAccountNameStyle" />
+
+    <TextView
         android:id="@+id/spinner_account_address"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_weight="1"
-        android:singleLine="true"
         android:textAlignment="viewStart"
         style="@style/ComposeFromTextViewStyle" />
 
diff --git a/res/values-ldrtl/styles-ldrtl.xml b/res/values-ldrtl/styles-ldrtl.xml
index 254bf68..f94abea 100644
--- a/res/values-ldrtl/styles-ldrtl.xml
+++ b/res/values-ldrtl/styles-ldrtl.xml
@@ -322,8 +322,8 @@
     </style>
     <!-- END Conversation list styles -->
 
-    <style name="SpinnerAccountAddressStyle" parent="ComposeFromTextViewStyle">
-        <item name="android:paddingStart">@dimen/custom_from_inner_padding</item>
+    <style name="SpinnerAccountNameStyle" parent="ComposeFromTextViewStyle">
+        <item name="android:paddingEnd">@dimen/custom_from_inner_padding</item>
     </style>
 
     <style name="AbstractComposeAreaWithRtl" parent="@style/AbstractComposeArea">
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 3098e20..e8a8faf 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -167,8 +167,8 @@
 
     <color name="actionbar_color">@color/mail_orange</color>
     <color name="statusbar_color">@color/statusbar_orange</color>
-    <!-- TODO: get real color from UX -->
-    <color name="action_mode_background">#9b9b9b</color>
+    <color name="action_mode_background">@color/text_color_grey</color>
+    <color name="action_mode_statusbar_color">#616161</color>
 
     <color name="snack_bar_background_color">#323232</color>
     <color name="snack_bar_action_text_color">#f4b400</color>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 4630cb6..d0a48f5 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -938,8 +938,8 @@
         <item name="android:textStyle">bold</item>
     </style>
 
-    <style name="SpinnerAccountAddressStyle" parent="ComposeFromTextViewStyle">
-        <item name="android:paddingLeft">@dimen/custom_from_inner_padding</item>
+    <style name="SpinnerAccountNameStyle" parent="ComposeFromTextViewStyle">
+        <item name="android:paddingRight">@dimen/custom_from_inner_padding</item>
     </style>
 
     <style name="FolderTeaserUnreadCountTextStyle">
diff --git a/src/com/android/mail/compose/FromAddressSpinnerAdapter.java b/src/com/android/mail/compose/FromAddressSpinnerAdapter.java
index a719c10..0d6804d 100644
--- a/src/com/android/mail/compose/FromAddressSpinnerAdapter.java
+++ b/src/com/android/mail/compose/FromAddressSpinnerAdapter.java
@@ -36,16 +36,8 @@
  * @author mindyp@google.com
  */
 public class FromAddressSpinnerAdapter extends ArrayAdapter<ReplyFromAccount> {
-    private static final int FROM = 0;
-    private static final int CUSTOM_FROM = 1;
     private static String sFormatString;
 
-    public static int REAL_ACCOUNT = 2;
-
-    public static int ACCOUNT_DISPLAY = 0;
-
-    public static int ACCOUNT_ADDRESS = 1;
-
     private LayoutInflater mInflater;
 
     public FromAddressSpinnerAdapter(Context context) {
@@ -62,27 +54,19 @@
     }
 
     @Override
-    public int getViewTypeCount() {
-        // FROM and CUSTOM_FROM
-        return 2;
-    }
-
-    @Override
-    public int getItemViewType(int pos) {
-        return getItem(pos).isCustomFrom ? CUSTOM_FROM : FROM;
-    }
-
-    @Override
     public View getView(int position, View convertView, ViewGroup parent) {
-        ReplyFromAccount fromItem = getItem(position);
-        int res = fromItem.isCustomFrom ? R.layout.custom_from_item : R.layout.from_item;
-        View fromEntry = convertView == null ? getInflater().inflate(res, null) : convertView;
+        final ReplyFromAccount fromItem = getItem(position);
+        final View fromEntry = convertView == null ?
+                getInflater().inflate(R.layout.from_item, null) : convertView;
+        final TextView nameView = (TextView) fromEntry.findViewById(R.id.spinner_account_name);
         if (fromItem.isCustomFrom) {
-            ((TextView) fromEntry.findViewById(R.id.spinner_account_name)).setText(fromItem.name);
+            nameView.setText(fromItem.name);
+            nameView.setVisibility(View.VISIBLE);
 
             ((TextView) fromEntry.findViewById(R.id.spinner_account_address))
                     .setText(formatAddress(fromItem.address));
         } else {
+            nameView.setVisibility(View.GONE);
             ((TextView) fromEntry.findViewById(R.id.spinner_account_address))
                     .setText(fromItem.address);
         }
@@ -91,10 +75,10 @@
 
     @Override
     public View getDropDownView(int position, View convertView, ViewGroup parent) {
-        ReplyFromAccount fromItem = getItem(position);
-        int res = fromItem.isCustomFrom ? R.layout.custom_from_dropdown_item
+        final ReplyFromAccount fromItem = getItem(position);
+        final int res = fromItem.isCustomFrom ? R.layout.custom_from_dropdown_item
                 : R.layout.from_dropdown_item;
-        View fromEntry = getInflater().inflate(res, null);
+        final View fromEntry = getInflater().inflate(res, null);
         if (fromItem.isCustomFrom) {
             ((TextView) fromEntry.findViewById(R.id.spinner_account_name)).setText(fromItem.name);
             ((TextView) fromEntry.findViewById(R.id.spinner_account_address))