Merge "Gmail crashes when switching to Promotion tab" into ub-gmail-ur14-dev
diff --git a/res/drawable-hdpi/ic_anonymous_avatar_48dp.png b/res/drawable-hdpi/ic_anonymous_avatar_48dp.png
new file mode 100644
index 0000000..dcb8b8f
--- /dev/null
+++ b/res/drawable-hdpi/ic_anonymous_avatar_48dp.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_generic_man.png b/res/drawable-hdpi/ic_generic_man.png
deleted file mode 100644
index b6b3129..0000000
--- a/res/drawable-hdpi/ic_generic_man.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_anonymous_avatar_48dp.png b/res/drawable-mdpi/ic_anonymous_avatar_48dp.png
new file mode 100644
index 0000000..6fde8d5
--- /dev/null
+++ b/res/drawable-mdpi/ic_anonymous_avatar_48dp.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_generic_man.png b/res/drawable-mdpi/ic_generic_man.png
deleted file mode 100644
index f763dd2..0000000
--- a/res/drawable-mdpi/ic_generic_man.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_anonymous_avatar_48dp.png b/res/drawable-xhdpi/ic_anonymous_avatar_48dp.png
new file mode 100644
index 0000000..8d467d5
--- /dev/null
+++ b/res/drawable-xhdpi/ic_anonymous_avatar_48dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_generic_man.png b/res/drawable-xhdpi/ic_generic_man.png
deleted file mode 100644
index 212293d..0000000
--- a/res/drawable-xhdpi/ic_generic_man.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_anonymous_avatar_48dp.png b/res/drawable-xxhdpi/ic_anonymous_avatar_48dp.png
new file mode 100644
index 0000000..0ccd71a
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_anonymous_avatar_48dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_generic_man.png b/res/drawable-xxhdpi/ic_generic_man.png
deleted file mode 100644
index 130c670..0000000
--- a/res/drawable-xxhdpi/ic_generic_man.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_anonymous_avatar_48dp.png b/res/drawable-xxxhdpi/ic_anonymous_avatar_48dp.png
new file mode 100644
index 0000000..00832f2
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_anonymous_avatar_48dp.png
Binary files differ
diff --git a/res/layout-sw600dp/floating_actions.xml b/res/layout-sw600dp/floating_actions.xml
index ea5ae51..28bc3cf 100644
--- a/res/layout-sw600dp/floating_actions.xml
+++ b/res/layout-sw600dp/floating_actions.xml
@@ -75,7 +75,6 @@
         android:id="@+id/compose_button"
         android:contentDescription="@string/compose"
         android:focusable="false"
-        android:focusableInTouchMode="false"
         style="@style/FloatingActionButtonStyle" />
 
 </LinearLayout>
diff --git a/res/layout/floating_actions.xml b/res/layout/floating_actions.xml
index 8df8612..ed4519f 100644
--- a/res/layout/floating_actions.xml
+++ b/res/layout/floating_actions.xml
@@ -25,7 +25,6 @@
         android:id="@+id/compose_button"
         android:contentDescription="@string/compose"
         android:focusable="false"
-        android:focusableInTouchMode="false"
         style="@style/FloatingActionButtonStyle" />
 
     <com.android.mail.ui.ActionableToastBar
diff --git a/res/layout/folder_list.xml b/res/layout/folder_list.xml
index 6cca4e0..acc375d 100644
--- a/res/layout/folder_list.xml
+++ b/res/layout/folder_list.xml
@@ -31,6 +31,7 @@
         android:id="@+id/mini_drawer"
         android:layout_width="@dimen/two_pane_drawer_width_mini"
         android:layout_height="match_parent"
+        android:focusable="true"
         android:paddingTop="20dp"
         android:paddingBottom="18dp"
         android:orientation="vertical">
diff --git a/src/com/android/mail/bitmap/ContactDrawable.java b/src/com/android/mail/bitmap/ContactDrawable.java
index 7acb2c9..df706e1 100644
--- a/src/com/android/mail/bitmap/ContactDrawable.java
+++ b/src/com/android/mail/bitmap/ContactDrawable.java
@@ -98,7 +98,7 @@
         if (sTileLetterFontSize == 0) {
             sTileLetterFontSize = res.getDimensionPixelSize(R.dimen.tile_letter_font_size_small);
             sTileFontColor = res.getColor(R.color.letter_tile_font_color);
-            DEFAULT_AVATAR = BitmapFactory.decodeResource(res, R.drawable.ic_generic_man);
+            DEFAULT_AVATAR = BitmapFactory.decodeResource(res, R.drawable.ic_anonymous_avatar_48dp);
 
             sPaint.setTypeface(Typeface.create("sans-serif-light", Typeface.NORMAL));
             sPaint.setTextAlign(Align.CENTER);
diff --git a/src/com/android/mail/photomanager/LetterTileProvider.java b/src/com/android/mail/photomanager/LetterTileProvider.java
index 3aaf7b1..8ab0aa8 100644
--- a/src/com/android/mail/photomanager/LetterTileProvider.java
+++ b/src/com/android/mail/photomanager/LetterTileProvider.java
@@ -41,7 +41,6 @@
  * tile. If there is no English alphabet character (or digit), it creates a
  * bitmap with the default contact avatar.
  */
-@Deprecated
 public class LetterTileProvider {
     private static final String TAG = LogTag.getLogTag();
     private final Bitmap mDefaultBitmap;
@@ -75,7 +74,7 @@
         mPaint.setAntiAlias(true);
         mBitmapBackgroundCache = new Bitmap[POSSIBLE_BITMAP_SIZES];
 
-        mDefaultBitmap = BitmapFactory.decodeResource(res, R.drawable.ic_generic_man);
+        mDefaultBitmap = BitmapFactory.decodeResource(res, R.drawable.ic_anonymous_avatar_48dp);
         mDefaultBitmapCache = new Bitmap[POSSIBLE_BITMAP_SIZES];
 
         mTileColorPicker = colorPicker;
diff --git a/src/com/android/mail/ui/ConversationListFragment.java b/src/com/android/mail/ui/ConversationListFragment.java
index 4e2c818..f9badb0 100644
--- a/src/com/android/mail/ui/ConversationListFragment.java
+++ b/src/com/android/mail/ui/ConversationListFragment.java
@@ -496,7 +496,7 @@
 
         // For tablets, the default left focus is the mini-drawer
         if (mTabletDevice && mNextFocusStartId == 0) {
-            mNextFocusStartId = R.id.current_account_avatar;
+            mNextFocusStartId = R.id.mini_drawer;
         }
         setNextFocusStartOnList();
 
diff --git a/src/com/android/mail/ui/MiniDrawerView.java b/src/com/android/mail/ui/MiniDrawerView.java
index 7aaac12..34483cc 100644
--- a/src/com/android/mail/ui/MiniDrawerView.java
+++ b/src/com/android/mail/ui/MiniDrawerView.java
@@ -18,6 +18,7 @@
 
 import android.content.Context;
 import android.database.DataSetObserver;
+import android.graphics.Rect;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -141,6 +142,15 @@
         }
     }
 
+    @Override
+    protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) {
+        if (gainFocus && getFocusedChild() == null) {
+            if (getChildCount() > 0) {
+                getChildAt(0).requestFocus();
+            }
+        }
+    }
+
     private class FolderItem implements View.OnClickListener {
         public final Folder folder;
         public final ImageView view;
diff --git a/src/com/android/mail/ui/TwoPaneController.java b/src/com/android/mail/ui/TwoPaneController.java
index 55b9e58..f2ccd71 100644
--- a/src/com/android/mail/ui/TwoPaneController.java
+++ b/src/com/android/mail/ui/TwoPaneController.java
@@ -316,7 +316,7 @@
     }
 
     private @IdRes int getClfNextFocusStartId(boolean drawerMinimized) {
-        return (drawerMinimized) ? R.id.current_account_avatar : android.R.id.list;
+        return (drawerMinimized) ? R.id.mini_drawer : android.R.id.list;
     }
 
     @Override
diff --git a/src/com/android/mail/utils/NotificationUtils.java b/src/com/android/mail/utils/NotificationUtils.java
index 31c61fa..536a73b 100644
--- a/src/com/android/mail/utils/NotificationUtils.java
+++ b/src/com/android/mail/utils/NotificationUtils.java
@@ -1344,6 +1344,9 @@
         // in the combined notification and add each one as a person.
         if (contactFetcher != null) {
             for (final String sender : sendersList) {
+                if (TextUtils.isEmpty(sender)) {
+                    continue;
+                }
                 final Uri contactLookupUri =
                         contactFetcher.getContactLookupUri(context,
                                 accountName, sender);