diff options
author | Fabrice Di Meglio <fdimeglio@google.com> | 2013-08-28 19:53:56 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-08-28 19:53:56 +0000 |
commit | 627dd9b584a267b206bace8dc518287fe58b9563 (patch) | |
tree | c0126fa82dfe01002dcf24c1d051fc470fb92732 /core | |
parent | f016a91247d591fd77e82383a84ae41606e30edd (diff) | |
parent | b08e5788a79127df2e2e452f5fb1adab417cb503 (diff) | |
download | frameworks_base-627dd9b584a267b206bace8dc518287fe58b9563.zip frameworks_base-627dd9b584a267b206bace8dc518287fe58b9563.tar.gz frameworks_base-627dd9b584a267b206bace8dc518287fe58b9563.tar.bz2 |
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
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/widget/CalendarView.java | 21 | ||||
-rw-r--r-- | core/res/res/values/styles.xml | 1 |
2 files changed, 12 insertions, 10 deletions
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 @@ public class CalendarView extends FrameLayout { * 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 @@ please see styles_device_defaults.xml. <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> |