Merge "RecyclerView: Add payload for efficient bind" into lmp-mr1-ub-dev
diff --git a/v7/appcompat/api/current.txt b/v7/appcompat/api/current.txt
index 0a24f7e..7651979 100644
--- a/v7/appcompat/api/current.txt
+++ b/v7/appcompat/api/current.txt
@@ -989,6 +989,8 @@
     field public static int Base_V21_Theme_AppCompat_Dialog;
     field public static int Base_V21_Theme_AppCompat_Light;
     field public static int Base_V21_Theme_AppCompat_Light_Dialog;
+    field public static int Base_V22_Theme_AppCompat;
+    field public static int Base_V22_Theme_AppCompat_Light;
     field public static int Base_V7_Theme_AppCompat;
     field public static int Base_V7_Theme_AppCompat_Dialog;
     field public static int Base_V7_Theme_AppCompat_Light;
@@ -1048,6 +1050,7 @@
     field public static int Base_Widget_AppCompat_Toolbar_Button_Navigation;
     field public static int Platform_AppCompat;
     field public static int Platform_AppCompat_Light;
+    field public static int Platform_ThemeOverlay_AppCompat;
     field public static int Platform_ThemeOverlay_AppCompat_Dark;
     field public static int Platform_ThemeOverlay_AppCompat_Light;
     field public static int Platform_V11_AppCompat;
diff --git a/v7/appcompat/res/values-v21/themes_base.xml b/v7/appcompat/res/values-v21/themes_base.xml
index 06b33b1..61cce2f 100644
--- a/v7/appcompat/res/values-v21/themes_base.xml
+++ b/v7/appcompat/res/values-v21/themes_base.xml
@@ -52,7 +52,6 @@
         <item name="actionMenuTextAppearance">?android:attr/actionMenuTextAppearance</item>
         <item name="actionModeBackground">?android:attr/actionModeBackground</item>
         <item name="actionModeCloseDrawable">?android:attr/actionModeCloseDrawable</item>
-        <item name="actionModeShareDrawable">?android:attr/actionModeShareDrawable</item>
         <item name="actionOverflowButtonStyle">?android:attr/actionOverflowButtonStyle</item>
         <item name="homeAsUpIndicator">?android:attr/homeAsUpIndicator</item>
 
@@ -102,7 +101,6 @@
         <item name="actionMenuTextAppearance">?android:attr/actionMenuTextAppearance</item>
         <item name="actionModeBackground">?android:attr/actionModeBackground</item>
         <item name="actionModeCloseDrawable">?android:attr/actionModeCloseDrawable</item>
-        <item name="actionModeShareDrawable">?android:attr/actionModeShareDrawable</item>
         <item name="actionOverflowButtonStyle">?android:attr/actionOverflowButtonStyle</item>
         <item name="homeAsUpIndicator">?android:attr/homeAsUpIndicator</item>
 
@@ -153,7 +151,7 @@
     <style name="Base.Theme.AppCompat.Dialog" parent="Base.V21.Theme.AppCompat.Dialog" />
     <style name="Base.Theme.AppCompat.Light.Dialog" parent="Base.V21.Theme.AppCompat.Light.Dialog" />
 
-    <style name="Platform.ThemeOverlay.AppCompat.Dark" parent="">
+    <style name="Platform.ThemeOverlay.AppCompat" parent="">
         <!-- Copy our color theme attributes to the framework -->
         <item name="android:colorPrimary">?attr/colorPrimary</item>
         <item name="android:colorPrimaryDark">?attr/colorPrimaryDark</item>
@@ -164,15 +162,8 @@
         <item name="android:colorButtonNormal">?attr/colorButtonNormal</item>
     </style>
 
-    <style name="Platform.ThemeOverlay.AppCompat.Light" parent="">
-        <!-- Copy our color theme attributes to the framework -->
-        <item name="android:colorPrimary">?attr/colorPrimary</item>
-        <item name="android:colorPrimaryDark">?attr/colorPrimaryDark</item>
-        <item name="android:colorAccent">?attr/colorAccent</item>
-        <item name="android:colorControlNormal">?attr/colorControlNormal</item>
-        <item name="android:colorControlActivated">?attr/colorControlActivated</item>
-        <item name="android:colorControlHighlight">?attr/colorControlHighlight</item>
-        <item name="android:colorButtonNormal">?attr/colorButtonNormal</item>
-    </style>
+    <style name="Platform.ThemeOverlay.AppCompat.Dark" />
+
+    <style name="Platform.ThemeOverlay.AppCompat.Light" />
 
 </resources>
diff --git a/v7/appcompat/res/values-v22/themes_base.xml b/v7/appcompat/res/values-v22/themes_base.xml
new file mode 100644
index 0000000..8a38724
--- /dev/null
+++ b/v7/appcompat/res/values-v22/themes_base.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2015 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.
+  -->
+
+<resources>
+
+    <style name="Base.Theme.AppCompat" parent="Base.V22.Theme.AppCompat" />
+    <style name="Base.Theme.AppCompat.Light" parent="Base.V22.Theme.AppCompat.Light" />
+
+    <style name="Base.V22.Theme.AppCompat" parent="Base.V21.Theme.AppCompat">
+        <item name="actionModeShareDrawable">?android:attr/actionModeShareDrawable</item>
+    </style>
+
+    <style name="Base.V22.Theme.AppCompat.Light" parent="Base.V21.Theme.AppCompat.Light">
+        <item name="actionModeShareDrawable">?android:attr/actionModeShareDrawable</item>
+    </style>
+
+</resources>
diff --git a/v7/appcompat/res/values/themes_base.xml b/v7/appcompat/res/values/themes_base.xml
index 5db9d05..3aba36e 100644
--- a/v7/appcompat/res/values/themes_base.xml
+++ b/v7/appcompat/res/values/themes_base.xml
@@ -519,9 +519,11 @@
     <style name="Base.Theme.AppCompat.Light.DialogWhenLarge" parent="Theme.AppCompat.Light" />
 
     <!-- Overlay themes -->
-    <style name="Base.ThemeOverlay.AppCompat" parent="" />
+    <style name="Platform.ThemeOverlay.AppCompat" parent="" />
 
-    <style name="Platform.ThemeOverlay.AppCompat.Dark" parent="">
+    <style name="Base.ThemeOverlay.AppCompat" parent="Platform.ThemeOverlay.AppCompat" />
+
+    <style name="Platform.ThemeOverlay.AppCompat.Dark">
         <!-- Action Bar styles -->
         <item name="actionBarItemBackground">@drawable/abc_item_background_holo_dark</item>
         <item name="actionDropDownStyle">@style/Widget.AppCompat.Spinner.DropDown.ActionBar</item>
@@ -532,7 +534,7 @@
         <item name="android:dropDownItemStyle">@style/Widget.AppCompat.DropDownItem.Spinner</item>
     </style>
 
-    <style name="Platform.ThemeOverlay.AppCompat.Light" parent="">
+    <style name="Platform.ThemeOverlay.AppCompat.Light">
         <item name="actionBarItemBackground">@drawable/abc_item_background_holo_light</item>
         <item name="actionDropDownStyle">@style/Widget.AppCompat.Light.Spinner.DropDown.ActionBar</item>
         <item name="selectableItemBackground">@drawable/abc_item_background_holo_light</item>
diff --git a/v7/appcompat/src/android/support/v7/app/AppCompatDelegateImplBase.java b/v7/appcompat/src/android/support/v7/app/AppCompatDelegateImplBase.java
index 411f17c..316256c 100644
--- a/v7/appcompat/src/android/support/v7/app/AppCompatDelegateImplBase.java
+++ b/v7/appcompat/src/android/support/v7/app/AppCompatDelegateImplBase.java
@@ -43,7 +43,7 @@
     final AppCompatCallback mAppCompatCallback;
 
     ActionBar mActionBar;
-    private MenuInflater mMenuInflater;
+    MenuInflater mMenuInflater;
 
     // true if this activity has an action bar.
     boolean mHasActionBar;
@@ -93,14 +93,13 @@
         return mActionBar;
     }
 
-    final void setSupportActionBar(ActionBar actionBar) {
-        mActionBar = actionBar;
-    }
-
     @Override
     public MenuInflater getMenuInflater() {
+        // Make sure that action views can get an appropriate theme.
         if (mMenuInflater == null) {
-            mMenuInflater = new SupportMenuInflater(getActionBarThemedContext());
+            initWindowDecorActionBar();
+            mMenuInflater = new SupportMenuInflater(
+                    mActionBar != null ? mActionBar.getThemedContext() : mContext);
         }
         return mMenuInflater;
     }
diff --git a/v7/appcompat/src/android/support/v7/app/AppCompatDelegateImplV7.java b/v7/appcompat/src/android/support/v7/app/AppCompatDelegateImplV7.java
index 3706972..f545bda 100644
--- a/v7/appcompat/src/android/support/v7/app/AppCompatDelegateImplV7.java
+++ b/v7/appcompat/src/android/support/v7/app/AppCompatDelegateImplV7.java
@@ -198,10 +198,12 @@
                     "by the window decor. Do not request Window.FEATURE_ACTION_BAR and set " +
                     "windowActionBar to false in your theme to use a Toolbar instead.");
         }
+        // Clear out the MenuInflater to make sure that it is valid for the new Action Bar
+        mMenuInflater = null;
 
         ToolbarActionBar tbab = new ToolbarActionBar(toolbar, ((Activity) mContext).getTitle(),
                 mAppCompatWindowCallback);
-        setSupportActionBar(tbab);
+        mActionBar = tbab;
         mWindow.setCallback(tbab.getWrappedWindowCallback());
         tbab.invalidateOptionsMenu();
     }
diff --git a/v7/appcompat/src/android/support/v7/graphics/drawable/DrawerArrowDrawable.java b/v7/appcompat/src/android/support/v7/graphics/drawable/DrawerArrowDrawable.java
index 439b3fb..a9e23de 100644
--- a/v7/appcompat/src/android/support/v7/graphics/drawable/DrawerArrowDrawable.java
+++ b/v7/appcompat/src/android/support/v7/graphics/drawable/DrawerArrowDrawable.java
@@ -208,12 +208,16 @@
 
     @Override
     public void setAlpha(int alpha) {
-        mPaint.setAlpha(alpha);
+        if (alpha != mPaint.getAlpha()) {
+            mPaint.setAlpha(alpha);
+            invalidateSelf();
+        }
     }
 
     @Override
     public void setColorFilter(ColorFilter colorFilter) {
         mPaint.setColorFilter(colorFilter);
+        invalidateSelf();
     }
 
     @Override
@@ -247,8 +251,10 @@
      * position.</p>
      */
     public void setProgress(@FloatRange(from = 0.0, to = 1.0) float progress) {
-        mProgress = progress;
-        invalidateSelf();
+        if (mProgress != progress) {
+            mProgress = progress;
+            invalidateSelf();
+        }
     }
 
     /**