Merge "Updated annotation to 1.1.0-beta01!" into androidx-master-dev
diff --git a/OWNERS b/OWNERS
index e4a4a30..091f1e7 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,5 +1,7 @@
 [email protected]
 [email protected]
[email protected]
[email protected]
 [email protected]
 [email protected]
 [email protected]
@@ -7,11 +9,12 @@
 [email protected]
 [email protected]
 [email protected]
[email protected]
[email protected]
 [email protected]
 [email protected]
 [email protected]
 [email protected]
[email protected]
 [email protected]
 [email protected]
[email protected]
[email protected]
diff --git a/appcompat/src/androidTest/java/androidx/appcompat/app/NightModeTestCase.java b/appcompat/src/androidTest/java/androidx/appcompat/app/NightModeTestCase.java
index baec85d..02b45bf 100644
--- a/appcompat/src/androidTest/java/androidx/appcompat/app/NightModeTestCase.java
+++ b/appcompat/src/androidTest/java/androidx/appcompat/app/NightModeTestCase.java
@@ -200,12 +200,6 @@
         // Assert that the Activity received a new value
         assertEquals(AppCompatDelegate.MODE_NIGHT_YES,
                 mActivityTestRule.getActivity().getLastNightModeAndReset());
-
-        // Set local night mode to NO
-        setLocalNightModeAndWait(mActivityTestRule, AppCompatDelegate.MODE_NIGHT_NO);
-        // Assert that the Activity received a new value
-        assertEquals(AppCompatDelegate.MODE_NIGHT_NO,
-                mActivityTestRule.getActivity().getLastNightModeAndReset());
     }
 
     @Test
diff --git a/appcompat/src/main/java/androidx/appcompat/app/AppCompatDelegateImpl.java b/appcompat/src/main/java/androidx/appcompat/app/AppCompatDelegateImpl.java
index dd77ab1..5d62ffa 100644
--- a/appcompat/src/main/java/androidx/appcompat/app/AppCompatDelegateImpl.java
+++ b/appcompat/src/main/java/androidx/appcompat/app/AppCompatDelegateImpl.java
@@ -2197,6 +2197,9 @@
             final boolean allowRecreation) {
         boolean handled = false;
 
+        final int applicationNightMode = mContext.getApplicationContext()
+                .getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
+
         int newNightMode;
         switch (mode) {
             case MODE_NIGHT_YES:
@@ -2209,16 +2212,14 @@
             case MODE_NIGHT_FOLLOW_SYSTEM:
                 // If we're following the system, we just use the system default from the
                 // application context
-                newNightMode = mContext.getApplicationContext()
-                        .getResources()
-                        .getConfiguration()
-                        .uiMode & Configuration.UI_MODE_NIGHT_MASK;
+                newNightMode = applicationNightMode;
                 break;
         }
 
         final boolean activityHandlingUiMode = isActivityManifestHandlingUiMode();
 
-        if (!activityHandlingUiMode && Build.VERSION.SDK_INT >= 17 && !mBaseContextAttached
+        if (newNightMode != applicationNightMode && !activityHandlingUiMode
+                && Build.VERSION.SDK_INT >= 17 && !mBaseContextAttached
                 && mHost instanceof android.view.ContextThemeWrapper) {
             // If we're here then we can try and apply an override configuration on the Context.
             final Configuration conf = new Configuration();
diff --git a/mediarouter/lint-baseline.xml b/mediarouter/lint-baseline.xml
deleted file mode 100644
index 2a350cc..0000000
--- a/mediarouter/lint-baseline.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<issues format="4" by="lint 3.0.0">
-
-    <issue
-        id="MissingSuperCall"
-        message="Overriding method should call `super.jumpDrawablesToCurrentState`"
-        errorLine1="    public void jumpDrawablesToCurrentState() {"
-        errorLine2="                ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
-        <location
-            file="src/main/java/androidx/mediarouter/app/MediaRouteButton.java"
-            line="379"
-            column="17"/>
-    </issue>
-
-    <issue
-        id="LongLogTag"
-        message="The logging tag can be at most 23 characters, was 24 (MediaRouteActionProvider)"
-        errorLine1="            Log.e(TAG, &quot;onCreateActionView: this ActionProvider is already associated &quot; +"
-        errorLine2="                  ~~~">
-        <location
-            file="src/main/java/androidx/mediarouter/app/MediaRouteActionProvider.java"
-            line="250"
-            column="19"/>
-    </issue>
-
-    <issue
-        id="AppCompatCustomView"
-        message="This custom view should extend `android.support.v7.widget.AppCompatImageButton` instead"
-        errorLine1="class MediaRouteExpandCollapseButton extends ImageButton {"
-        errorLine2="                                             ~~~~~~~~~~~">
-        <location
-            file="src/main/java/androidx/mediarouter/app/MediaRouteExpandCollapseButton.java"
-            line="34"
-            column="46"/>
-    </issue>
-
-</issues>
diff --git a/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteActionProvider.java b/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteActionProvider.java
index 6dd4e27..aa86677 100644
--- a/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteActionProvider.java
+++ b/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteActionProvider.java
@@ -129,7 +129,7 @@
  * @see #setRouteSelector
  */
 public class MediaRouteActionProvider extends ActionProvider {
-    private static final String TAG = "MediaRouteActionProvider";
+    private static final String TAG = "MRActionProvider";
 
     private final MediaRouter mRouter;
     private final MediaRouterCallback mCallback;
diff --git a/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteButton.java b/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteButton.java
index 2ff24e0..fbdc209 100644
--- a/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteButton.java
+++ b/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteButton.java
@@ -437,15 +437,11 @@
 
     @Override
     public void jumpDrawablesToCurrentState() {
-        // We can't call super to handle the background so we do it ourselves.
-        //super.jumpDrawablesToCurrentState();
-        if (getBackground() != null) {
-            DrawableCompat.jumpToCurrentState(getBackground());
-        }
+        super.jumpDrawablesToCurrentState();
 
         // Handle our own remote indicator.
         if (mRemoteIndicator != null) {
-            DrawableCompat.jumpToCurrentState(mRemoteIndicator);
+            mRemoteIndicator.jumpToCurrentState();
         }
     }
 
diff --git a/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteExpandCollapseButton.java b/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteExpandCollapseButton.java
index 5c5cf65..b3b1e34 100644
--- a/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteExpandCollapseButton.java
+++ b/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteExpandCollapseButton.java
@@ -23,15 +23,15 @@
 import android.graphics.drawable.AnimationDrawable;
 import android.util.AttributeSet;
 import android.view.View;
-import android.widget.ImageButton;
 
+import androidx.appcompat.widget.AppCompatImageButton;
 import androidx.core.content.ContextCompat;
 import androidx.mediarouter.R;
 
 /**
  * Chevron/Caret button to expand/collapse group volume list with animation.
  */
-class MediaRouteExpandCollapseButton extends ImageButton {
+class MediaRouteExpandCollapseButton extends AppCompatImageButton {
     final AnimationDrawable mExpandAnimationDrawable;
     final AnimationDrawable mCollapseAnimationDrawable;
     final String mExpandGroupDescription;
diff --git a/preference/build.gradle b/preference/build.gradle
index 7c66472..680046c 100644
--- a/preference/build.gradle
+++ b/preference/build.gradle
@@ -51,6 +51,10 @@
         ]
     }
 
+    defaultConfig {
+        vectorDrawables.useSupportLibrary = true
+    }
+
     buildTypes.all {
         consumerProguardFiles 'proguard-rules.pro'
     }
diff --git a/preference/res/drawable-v21/ic_arrow_down_24dp.xml b/preference/res/drawable-v21/ic_arrow_down_24dp.xml
index 1815b8c..f32f5f4d 100644
--- a/preference/res/drawable-v21/ic_arrow_down_24dp.xml
+++ b/preference/res/drawable-v21/ic_arrow_down_24dp.xml
@@ -19,8 +19,8 @@
         android:height="24dp"
         android:viewportWidth="24.0"
         android:viewportHeight="24.0"
-        android:tint="?android:attr/colorAccent">
+        android:tint="?android:attr/colorControlNormal">
     <path
         android:fillColor="#FF000000"
-        android:pathData="M7.41,7.84L12,12.42l4.59,-4.58L18,9.25l-6,6 -6,-6z"/>
+        android:pathData="M12,16.41l-6.71,-6.7l1.42,-1.42l5.29,5.3l5.29,-5.3l1.42,1.42z"/>
 </vector>
diff --git a/preference/res/layout/expand_button.xml b/preference/res/layout/expand_button.xml
index 6bf02a2..3bcb489 100644
--- a/preference/res/layout/expand_button.xml
+++ b/preference/res/layout/expand_button.xml
@@ -23,8 +23,8 @@
     android:minHeight="?android:attr/listPreferredItemHeightSmall"
     android:gravity="center_vertical"
     android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
-    android:paddingRight="?android:attr/listPreferredItemPaddingRight"
     android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+    android:paddingRight="?android:attr/listPreferredItemPaddingRight"
     android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
     android:background="?android:attr/selectableItemBackground"
     android:clipToPadding="false"
diff --git a/preference/res/layout/image_frame.xml b/preference/res/layout/image_frame.xml
index 155896b..adc3613 100644
--- a/preference/res/layout/image_frame.xml
+++ b/preference/res/layout/image_frame.xml
@@ -23,6 +23,8 @@
     android:minWidth="56dp"
     android:gravity="start|center_vertical"
     android:orientation="horizontal"
+    android:paddingLeft="0dp"
+    android:paddingStart="0dp"
     android:paddingRight="8dp"
     android:paddingEnd="8dp"
     android:paddingTop="4dp"
diff --git a/preference/res/layout/preference_category_material.xml b/preference/res/layout/preference_category_material.xml
index c4566c7..8611e1e 100644
--- a/preference/res/layout/preference_category_material.xml
+++ b/preference/res/layout/preference_category_material.xml
@@ -20,8 +20,8 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
-    android:paddingRight="?android:attr/listPreferredItemPaddingRight"
     android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+    android:paddingRight="?android:attr/listPreferredItemPaddingRight"
     android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
     android:background="?android:attr/selectableItemBackground"
     android:baselineAligned="false"
diff --git a/preference/res/layout/preference_material.xml b/preference/res/layout/preference_material.xml
index f2e02fb..6e55cfc 100644
--- a/preference/res/layout/preference_material.xml
+++ b/preference/res/layout/preference_material.xml
@@ -22,8 +22,8 @@
     android:minHeight="?android:attr/listPreferredItemHeightSmall"
     android:gravity="center_vertical"
     android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
-    android:paddingRight="?android:attr/listPreferredItemPaddingRight"
     android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+    android:paddingRight="?android:attr/listPreferredItemPaddingRight"
     android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
     android:background="?android:attr/selectableItemBackground"
     android:clipToPadding="false"
@@ -69,6 +69,8 @@
         android:gravity="end|center_vertical"
         android:paddingLeft="16dp"
         android:paddingStart="16dp"
+        android:paddingRight="0dp"
+        android:paddingEnd="0dp"
         android:orientation="vertical"/>
 
 </LinearLayout>
diff --git a/preference/res/layout/preference_widget_seekbar_material.xml b/preference/res/layout/preference_widget_seekbar_material.xml
index 25872c1..3689e4d 100644
--- a/preference/res/layout/preference_widget_seekbar_material.xml
+++ b/preference/res/layout/preference_widget_seekbar_material.xml
@@ -23,8 +23,8 @@
     android:minHeight="?android:attr/listPreferredItemHeightSmall"
     android:gravity="center_vertical"
     android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
-    android:paddingRight="?android:attr/listPreferredItemPaddingRight"
     android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+    android:paddingRight="?android:attr/listPreferredItemPaddingRight"
     android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
     android:background="?android:attr/selectableItemBackground"
     android:clipChildren="false"
@@ -77,6 +77,8 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:gravity="center_vertical"
+            android:paddingLeft="0dp"
+            android:paddingStart="0dp"
             android:paddingRight="16dp"
             android:paddingEnd="16dp"
             android:clipChildren="false"
@@ -96,8 +98,8 @@
                 android:layout_weight="1"
                 android:layout_height="wrap_content"
                 android:paddingLeft="@dimen/preference_seekbar_padding_horizontal"
-                android:paddingRight="@dimen/preference_seekbar_padding_horizontal"
                 android:paddingStart="@dimen/preference_seekbar_padding_horizontal"
+                android:paddingRight="@dimen/preference_seekbar_padding_horizontal"
                 android:paddingEnd="@dimen/preference_seekbar_padding_horizontal"
                 android:paddingTop="@dimen/preference_seekbar_padding_vertical"
                 android:paddingBottom="@dimen/preference_seekbar_padding_vertical"
@@ -111,6 +113,8 @@
                 android:minWidth="@dimen/preference_seekbar_value_minWidth"
                 android:paddingLeft="8dp"
                 android:paddingStart="8dp"
+                android:paddingRight="0dp"
+                android:paddingEnd="0dp"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:gravity="right"
diff --git a/preference/res/values/styles.xml b/preference/res/values/styles.xml
index 001e097..6ab5a60 100644
--- a/preference/res/values/styles.xml
+++ b/preference/res/values/styles.xml
@@ -22,8 +22,8 @@
 
     <style name="PreferenceFragment">
         <item name="android:paddingLeft">0dp</item>
-        <item name="android:paddingRight">0dp</item>
         <item name="android:paddingStart">0dp</item>
+        <item name="android:paddingRight">0dp</item>
         <item name="android:paddingEnd">0dp</item>
         <item name="android:divider">?android:attr/listDivider</item>
     </style>
@@ -72,8 +72,8 @@
 
     <style name="PreferenceFragmentList">
         <item name="android:paddingLeft">16dp</item>
-        <item name="android:paddingRight">16dp</item>
         <item name="android:paddingStart">16dp</item>
+        <item name="android:paddingRight">16dp</item>
         <item name="android:paddingEnd">16dp</item>
     </style>
 
@@ -175,8 +175,8 @@
 
     <style name="PreferenceFragmentList.Material">
         <item name="android:paddingLeft">0dp</item>
-        <item name="android:paddingRight">0dp</item>
         <item name="android:paddingStart">0dp</item>
+        <item name="android:paddingRight">0dp</item>
         <item name="android:paddingEnd">0dp</item>
     </style>
 
diff --git a/samples/SupportPreferenceDemos/src/main/res/values-v21/styles.xml b/samples/SupportPreferenceDemos/src/main/res/values-v21/styles.xml
index 4cdb7ec..426aa43 100644
--- a/samples/SupportPreferenceDemos/src/main/res/values-v21/styles.xml
+++ b/samples/SupportPreferenceDemos/src/main/res/values-v21/styles.xml
@@ -16,6 +16,8 @@
   -->
 
 <resources>
+    <!-- Theme for the main activity that shows all fragments, change PreferenceTheme in
+         values/styles.xml for the theme for the actual fragment hosting Preferences -->
     <style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
         <item name="android:colorPrimary">#3F51B5</item>
         <item name="android:colorPrimaryDark">#303F9F</item>