|
42 | 42 | import com.android.internal.R; |
43 | 43 | import com.android.internal.widget.ExploreByTouchHelper; |
44 | 44 |
|
| 45 | +import java.text.NumberFormat; |
45 | 46 | import java.text.SimpleDateFormat; |
46 | 47 | import java.util.Calendar; |
47 | 48 | import java.util.Locale; |
@@ -73,6 +74,7 @@ class SimpleMonthView extends View { |
73 | 74 |
|
74 | 75 | private final SimpleDateFormat mTitleFormatter; |
75 | 76 | private final SimpleDateFormat mDayOfWeekFormatter; |
| 77 | + private final NumberFormat mDayFormatter; |
76 | 78 |
|
77 | 79 | // Desired dimensions. |
78 | 80 | private final int mDesiredMonthHeight; |
@@ -162,6 +164,7 @@ public SimpleMonthView(Context context, AttributeSet attrs, int defStyleAttr, in |
162 | 164 | final String titleFormat = DateFormat.getBestDateTimePattern(locale, DEFAULT_TITLE_FORMAT); |
163 | 165 | mTitleFormatter = new SimpleDateFormat(titleFormat, locale); |
164 | 166 | mDayOfWeekFormatter = new SimpleDateFormat(DAY_OF_WEEK_FORMAT, locale); |
| 167 | + mDayFormatter = NumberFormat.getIntegerInstance(locale); |
165 | 168 |
|
166 | 169 | initPaints(res); |
167 | 170 | } |
@@ -454,7 +457,7 @@ private void drawDays(Canvas canvas) { |
454 | 457 | } |
455 | 458 | p.setColor(dayTextColor); |
456 | 459 |
|
457 | | - canvas.drawText(Integer.toString(day), colCenterRtl, rowCenter - halfLineHeight, p); |
| 460 | + canvas.drawText(mDayFormatter.format(day), colCenterRtl, rowCenter - halfLineHeight, p); |
458 | 461 |
|
459 | 462 | col++; |
460 | 463 |
|
@@ -866,7 +869,7 @@ private CharSequence getDayDescription(int id) { |
866 | 869 | */ |
867 | 870 | private CharSequence getDayText(int id) { |
868 | 871 | if (isValidDayOfMonth(id)) { |
869 | | - return Integer.toString(id); |
| 872 | + return mDayFormatter.format(id); |
870 | 873 | } |
871 | 874 |
|
872 | 875 | return null; |
|
0 commit comments