* commit 'fcba54eb88e8f4ef867d2205485e391d9855ef4a': Localize SimpleMonthView
This commit is contained in:
@@ -42,6 +42,7 @@ import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
|
|||||||
import com.android.internal.R;
|
import com.android.internal.R;
|
||||||
import com.android.internal.widget.ExploreByTouchHelper;
|
import com.android.internal.widget.ExploreByTouchHelper;
|
||||||
|
|
||||||
|
import java.text.NumberFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -73,6 +74,7 @@ class SimpleMonthView extends View {
|
|||||||
|
|
||||||
private final SimpleDateFormat mTitleFormatter;
|
private final SimpleDateFormat mTitleFormatter;
|
||||||
private final SimpleDateFormat mDayOfWeekFormatter;
|
private final SimpleDateFormat mDayOfWeekFormatter;
|
||||||
|
private final NumberFormat mDayFormatter;
|
||||||
|
|
||||||
// Desired dimensions.
|
// Desired dimensions.
|
||||||
private final int mDesiredMonthHeight;
|
private final int mDesiredMonthHeight;
|
||||||
@@ -162,6 +164,7 @@ class SimpleMonthView extends View {
|
|||||||
final String titleFormat = DateFormat.getBestDateTimePattern(locale, DEFAULT_TITLE_FORMAT);
|
final String titleFormat = DateFormat.getBestDateTimePattern(locale, DEFAULT_TITLE_FORMAT);
|
||||||
mTitleFormatter = new SimpleDateFormat(titleFormat, locale);
|
mTitleFormatter = new SimpleDateFormat(titleFormat, locale);
|
||||||
mDayOfWeekFormatter = new SimpleDateFormat(DAY_OF_WEEK_FORMAT, locale);
|
mDayOfWeekFormatter = new SimpleDateFormat(DAY_OF_WEEK_FORMAT, locale);
|
||||||
|
mDayFormatter = NumberFormat.getIntegerInstance(locale);
|
||||||
|
|
||||||
initPaints(res);
|
initPaints(res);
|
||||||
}
|
}
|
||||||
@@ -454,7 +457,7 @@ class SimpleMonthView extends View {
|
|||||||
}
|
}
|
||||||
p.setColor(dayTextColor);
|
p.setColor(dayTextColor);
|
||||||
|
|
||||||
canvas.drawText(Integer.toString(day), colCenterRtl, rowCenter - halfLineHeight, p);
|
canvas.drawText(mDayFormatter.format(day), colCenterRtl, rowCenter - halfLineHeight, p);
|
||||||
|
|
||||||
col++;
|
col++;
|
||||||
|
|
||||||
@@ -866,7 +869,7 @@ class SimpleMonthView extends View {
|
|||||||
*/
|
*/
|
||||||
private CharSequence getDayText(int id) {
|
private CharSequence getDayText(int id) {
|
||||||
if (isValidDayOfMonth(id)) {
|
if (isValidDayOfMonth(id)) {
|
||||||
return Integer.toString(id);
|
return mDayFormatter.format(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user