Merge "Update notif text colors for L. b/17515503" into ub-gmail-ur14-dev
diff --git a/assets/script.js b/assets/script.js
index 3834a77..c629654 100644
--- a/assets/script.js
+++ b/assets/script.js
@@ -784,7 +784,7 @@
                 alert(MSG_FORMS_ARE_DISABLED);
                 return false;
             }
-            elements = form[i].elements;
+            elements = forms[i].elements;
             for (j = 0; j < elements.length; ++j) {
                 elements[j].readOnly = true;
             }
diff --git a/res/values/colors.xml b/res/values/colors.xml
index e8a8faf..fdb2ce1 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -58,7 +58,7 @@
     <!-- Compose colors -->
     <color name="compose_label_text">@color/text_color_grey</color>
     <color name="compose_user_text">@color/text_color_black</color>
-    <color name="compose_label_hint">@color/light_gray</color>
+    <color name="compose_label_hint">#999999</color>
     <color name="compose_divider_color">@color/light_gray</color>
     <!-- Must match the quoted_text_background_color_string -->
     <color name="compose_background_color">@android:color/white</color>
diff --git a/src/com/android/mail/compose/ComposeActivity.java b/src/com/android/mail/compose/ComposeActivity.java
index e4ef81f..24d6834 100644
--- a/src/com/android/mail/compose/ComposeActivity.java
+++ b/src/com/android/mail/compose/ComposeActivity.java
@@ -51,6 +51,7 @@
 import android.support.v4.app.RemoteInput;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.ActionBarActivity;
+import android.support.v7.view.ActionMode;
 import android.text.Editable;
 import android.text.Html;
 import android.text.SpanWatcher;
@@ -69,6 +70,7 @@
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.ViewGroup;
+import android.view.Window;
 import android.view.inputmethod.BaseInputConnection;
 import android.view.inputmethod.EditorInfo;
 import android.widget.ArrayAdapter;
@@ -3961,4 +3963,30 @@
             mBodyView.addTextChangedListener(ComposeActivity.this);
         }
     }
+
+    @SuppressLint("NewApi")
+    @Override
+    public void onSupportActionModeStarted(ActionMode mode) {
+        super.onSupportActionModeStarted(mode);
+        if (Utils.isRunningLOrLater()) {
+            final Window window = getWindow();
+            if (window != null) {
+                window.setStatusBarColor(
+                        getResources().getColor(R.color.action_mode_statusbar_color));
+            }
+        }
+    }
+
+    @SuppressLint("NewApi")
+    @Override
+    public void onSupportActionModeFinished(ActionMode mode) {
+        super.onSupportActionModeFinished(mode);
+        if (Utils.isRunningLOrLater()) {
+            final Window window = getWindow();
+            if (window != null) {
+                window.setStatusBarColor(
+                        getResources().getColor(R.color.statusbar_color));
+            }
+        }
+    }
 }
diff --git a/src/com/android/mail/ui/AttachmentTile.java b/src/com/android/mail/ui/AttachmentTile.java
index 3fc8dc5..da1a4b9 100644
--- a/src/com/android/mail/ui/AttachmentTile.java
+++ b/src/com/android/mail/ui/AttachmentTile.java
@@ -94,7 +94,7 @@
     protected void onLayout(boolean changed, int l, int t, int r, int b) {
         super.onLayout(changed, l, t, r, b);
 
-        ThumbnailLoadTask.setupThumbnailPreview(this, mAttachment, null);
+        ThumbnailLoadTask.setupThumbnailPreview(mAttachmentPreviewCache, this, mAttachment, null);
     }
 
     public Attachment getAttachment() {
@@ -136,7 +136,8 @@
             updateSubtitleText();
         }
 
-        ThumbnailLoadTask.setupThumbnailPreview(this, attachment, prevAttachment);
+        ThumbnailLoadTask.setupThumbnailPreview(mAttachmentPreviewCache, this, attachment,
+                prevAttachment);
     }
 
     private void updateSubtitleText() {
@@ -153,7 +154,7 @@
 
     @Override
     public void setThumbnailToDefault() {
-        Bitmap cachedPreview = mAttachmentPreviewCache.get(mAttachment);
+        final Bitmap cachedPreview = mAttachmentPreviewCache.get(mAttachment);
         if (cachedPreview != null) {
             setThumbnail(cachedPreview);
             return;
diff --git a/src/com/android/mail/ui/MailActivity.java b/src/com/android/mail/ui/MailActivity.java
index 8aa8fbc..bcba078 100644
--- a/src/com/android/mail/ui/MailActivity.java
+++ b/src/com/android/mail/ui/MailActivity.java
@@ -17,8 +17,8 @@
 
 package com.android.mail.ui;
 
+import android.annotation.SuppressLint;
 import android.app.Dialog;
-import android.app.LoaderManager;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
@@ -29,11 +29,13 @@
 import android.nfc.NfcEvent;
 import android.os.Bundle;
 import android.support.v7.app.ActionBar;
+import android.support.v7.view.ActionMode;
 import android.support.v7.widget.Toolbar;
 import android.view.KeyEvent;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.MotionEvent;
+import android.view.Window;
 import android.view.accessibility.AccessibilityManager;
 
 import com.android.bitmap.BitmapCache;
@@ -489,4 +491,30 @@
     public SearchRecentSuggestionsProvider getSuggestionsProvider() {
         return new SuggestionsProvider(this);
     }
+
+    @SuppressLint("NewApi")
+    @Override
+    public void onSupportActionModeStarted(ActionMode mode) {
+        super.onSupportActionModeStarted(mode);
+        if (Utils.isRunningLOrLater()) {
+            final Window window = getWindow();
+            if (window != null) {
+                window.setStatusBarColor(
+                        getResources().getColor(R.color.action_mode_statusbar_color));
+            }
+        }
+    }
+
+    @SuppressLint("NewApi")
+    @Override
+    public void onSupportActionModeFinished(ActionMode mode) {
+        super.onSupportActionModeFinished(mode);
+        if (Utils.isRunningLOrLater()) {
+            final Window window = getWindow();
+            if (window != null) {
+                window.setStatusBarColor(
+                        getResources().getColor(R.color.statusbar_color));
+            }
+        }
+    }
 }
diff --git a/src/com/android/mail/ui/ThumbnailLoadTask.java b/src/com/android/mail/ui/ThumbnailLoadTask.java
index 71e2cc2..3709eee 100644
--- a/src/com/android/mail/ui/ThumbnailLoadTask.java
+++ b/src/com/android/mail/ui/ThumbnailLoadTask.java
@@ -48,8 +48,17 @@
     private final int mWidth;
     private final int mHeight;
 
-    public static void setupThumbnailPreview(final AttachmentBitmapHolder holder,
-            final Attachment attachment, final Attachment prevAttachment) {
+    public static void setupThumbnailPreview(AttachmentTile.AttachmentPreviewCache cache,
+            AttachmentBitmapHolder holder, Attachment attachment, Attachment prevAttachment) {
+        // Check cache first
+        if (cache != null) {
+            final Bitmap cached = cache.get(attachment);
+            if (cached != null) {
+                holder.setThumbnail(cached);
+                return;
+            }
+        }
+
         final int width = holder.getThumbnailWidth();
         final int height = holder.getThumbnailHeight();
         if (attachment == null || width == 0 || height == 0
@@ -60,7 +69,7 @@
 
         final Uri thumbnailUri = attachment.thumbnailUri;
         final Uri contentUri = attachment.contentUri;
-        final Uri uri = (prevAttachment == null) ? null : prevAttachment.getIdentifierUri();
+        final Uri uri = attachment.getIdentifierUri();
         final Uri prevUri = (prevAttachment == null) ? null : prevAttachment.getIdentifierUri();
         // begin loading a thumbnail if this is an image and either the thumbnail or the original
         // content is ready (and different from any existing image)