diff options
author | Chet Haase <chet@google.com> | 2015-07-17 12:42:08 -0700 |
---|---|---|
committer | Chet Haase <chet@google.com> | 2015-07-17 14:26:17 -0700 |
commit | 1ea4715cecf8d1a17a21f3d21ea4df56519e5ea6 (patch) | |
tree | 1b2212f4669c4a1ff4e8ba982d18940504313150 /core/java/android/widget/SimpleMonthView.java | |
parent | e6b407b4be0b9c8240d34259b14e324da4d6832b (diff) | |
download | frameworks_base-1ea4715cecf8d1a17a21f3d21ea4df56519e5ea6.zip frameworks_base-1ea4715cecf8d1a17a21f3d21ea4df56519e5ea6.tar.gz frameworks_base-1ea4715cecf8d1a17a21f3d21ea4df56519e5ea6.tar.bz2 |
Localize SimpleMonthView
The days of the month were not being localized, resulting in
English numbers for non-English languages. Now we format the numbers
with the current locale.
Issue #22540629 [MRA14D][Arab][Token] numbers displayed in english
Change-Id: I2b17d55ba2d0aa47b5a28c8846c6cf9723ababb1
Diffstat (limited to 'core/java/android/widget/SimpleMonthView.java')
-rw-r--r-- | core/java/android/widget/SimpleMonthView.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/java/android/widget/SimpleMonthView.java b/core/java/android/widget/SimpleMonthView.java index acf1df9..6e04eac 100644 --- a/core/java/android/widget/SimpleMonthView.java +++ b/core/java/android/widget/SimpleMonthView.java @@ -42,6 +42,7 @@ import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; import com.android.internal.R; import com.android.internal.widget.ExploreByTouchHelper; +import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; @@ -73,6 +74,7 @@ class SimpleMonthView extends View { private final SimpleDateFormat mTitleFormatter; private final SimpleDateFormat mDayOfWeekFormatter; + private final NumberFormat mDayFormatter; // Desired dimensions. private final int mDesiredMonthHeight; @@ -162,6 +164,7 @@ class SimpleMonthView extends View { final String titleFormat = DateFormat.getBestDateTimePattern(locale, DEFAULT_TITLE_FORMAT); mTitleFormatter = new SimpleDateFormat(titleFormat, locale); mDayOfWeekFormatter = new SimpleDateFormat(DAY_OF_WEEK_FORMAT, locale); + mDayFormatter = NumberFormat.getIntegerInstance(locale); initPaints(res); } @@ -454,7 +457,7 @@ class SimpleMonthView extends View { } p.setColor(dayTextColor); - canvas.drawText(Integer.toString(day), colCenterRtl, rowCenter - halfLineHeight, p); + canvas.drawText(mDayFormatter.format(day), colCenterRtl, rowCenter - halfLineHeight, p); col++; @@ -866,7 +869,7 @@ class SimpleMonthView extends View { */ private CharSequence getDayText(int id) { if (isValidDayOfMonth(id)) { - return Integer.toString(id); + return mDayFormatter.format(id); } return null; |