am f73df21a: am 627dd9b5: Merge "Fix bug #10515013 CalendarView is always forcing first day of the week to Sunday and not taking into account CLDR data" into klp-dev

* commit 'f73df21a8e311ab72a00dbdb0b1dbd8e8d79a143':
  Fix bug #10515013 CalendarView is always forcing first day of the week to Sunday and not taking into account CLDR data
diff --git a/core/java/android/widget/CalendarView.java b/core/java/android/widget/CalendarView.java
index 6970cde..de2be75 100644
--- a/core/java/android/widget/CalendarView.java
+++ b/core/java/android/widget/CalendarView.java
@@ -1028,26 +1028,29 @@
      * Sets up the strings to be used by the header.
      */
     private void setUpHeader() {
+        final String[] tinyWeekdayNames = LocaleData.get(Locale.getDefault()).tinyWeekdayNames;
         mDayLabels = new String[mDaysPerWeek];
-        for (int i = mFirstDayOfWeek, count = mFirstDayOfWeek + mDaysPerWeek; i < count; i++) {
-            int calendarDay = (i > Calendar.SATURDAY) ? i - Calendar.SATURDAY : i;
-            mDayLabels[i - mFirstDayOfWeek] = DateUtils.getDayOfWeekString(calendarDay,
-                    DateUtils.LENGTH_SHORTEST);
+        for (int i = 0; i < mDaysPerWeek; i++) {
+            final int j = i + mFirstDayOfWeek;
+            final int calendarDay = (j > Calendar.SATURDAY) ? j - Calendar.SATURDAY : j;
+            mDayLabels[i] = tinyWeekdayNames[calendarDay];
         }
-
+        // Deal with week number
         TextView label = (TextView) mDayNamesHeader.getChildAt(0);
         if (mShowWeekNumber) {
             label.setVisibility(View.VISIBLE);
         } else {
             label.setVisibility(View.GONE);
         }
-        for (int i = 1, count = mDayNamesHeader.getChildCount(); i < count; i++) {
-            label = (TextView) mDayNamesHeader.getChildAt(i);
+        // Deal with day labels
+        final int count = mDayNamesHeader.getChildCount();
+        for (int i = 0; i < count - 1; i++) {
+            label = (TextView) mDayNamesHeader.getChildAt(i + 1);
             if (mWeekDayTextAppearanceResId > -1) {
                 label.setTextAppearance(mContext, mWeekDayTextAppearanceResId);
             }
-            if (i < mDaysPerWeek + 1) {
-                label.setText(mDayLabels[i - 1]);
+            if (i < mDaysPerWeek) {
+                label.setText(mDayLabels[i]);
                 label.setVisibility(View.VISIBLE);
             } else {
                 label.setVisibility(View.GONE);
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 879d0f1..ba72a2b 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -529,7 +529,6 @@
 
     <style name="Widget.CalendarView">
         <item name="android:showWeekNumber">true</item>
-        <item name="android:firstDayOfWeek">1</item>
         <item name="android:minDate">01/01/1900</item>
         <item name="android:maxDate">12/31/2100</item>
         <item name="android:shownWeekCount">6</item>