Make AppCompatSpinner read android:entries

Allows us to use our own dropdown item layout
by default, ensuring that it looks the same on
all API levels by default.

BUG: 25174183
Change-Id: I010f5b3f53d40fe00c00063f0c8a9555bf728448
diff --git a/v7/appcompat/api/current.txt b/v7/appcompat/api/current.txt
index 2d53759..8f35544 100644
--- a/v7/appcompat/api/current.txt
+++ b/v7/appcompat/api/current.txt
@@ -1405,6 +1405,7 @@
     field public static int SearchView_voiceIcon;
     field public static final int[] Spinner;
     field public static int Spinner_android_dropDownWidth;
+    field public static int Spinner_android_entries;
     field public static int Spinner_android_popupBackground;
     field public static int Spinner_android_prompt;
     field public static int Spinner_popupTheme;
diff --git a/v7/appcompat/res/values/attrs.xml b/v7/appcompat/res/values/attrs.xml
index 3300564..83cb1b2 100644
--- a/v7/appcompat/res/values/attrs.xml
+++ b/v7/appcompat/res/values/attrs.xml
@@ -686,6 +686,8 @@
         <attr name="android:popupBackground" />
         <!-- Width of the dropdown in spinnerMode="dropdown". -->
         <attr name="android:dropDownWidth" />
+        <!-- Reference to an array resource that will populate the Spinner. -->
+        <attr name="android:entries" />
     </declare-styleable>
 
     <declare-styleable name="SearchView">
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatSpinner.java b/v7/appcompat/src/android/support/v7/widget/AppCompatSpinner.java
index fa0ef54..1dc46c4 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatSpinner.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatSpinner.java
@@ -41,6 +41,7 @@
 import android.view.ViewGroup;
 import android.view.ViewTreeObserver;
 import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
 import android.widget.ListAdapter;
 import android.widget.ListView;
 import android.widget.PopupWindow;
@@ -267,6 +268,15 @@
                 };
             }
         }
+
+        final CharSequence[] entries = a.getTextArray(R.styleable.Spinner_android_entries);
+        if (entries != null) {
+            final ArrayAdapter<CharSequence> adapter = new ArrayAdapter<>(context,
+                    R.layout.support_simple_spinner_dropdown_item, entries);
+            adapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);
+            setAdapter(adapter);
+        }
+
         a.recycle();
 
         mPopupSet = true;