Merge \"Correclty capitalize Date in status bar panel\" into nyc-dev
am: 366f324113
Change-Id: I825b14e12ec6f4f3896629bd66f882b6f2e9ffec
This commit is contained in:
@@ -21,7 +21,8 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.text.format.DateFormat;
|
import android.icu.text.DateFormat;
|
||||||
|
import android.icu.text.DisplayContext;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ public class DateView extends TextView {
|
|||||||
|
|
||||||
private final Date mCurrentTime = new Date();
|
private final Date mCurrentTime = new Date();
|
||||||
|
|
||||||
private SimpleDateFormat mDateFormat;
|
private DateFormat mDateFormat;
|
||||||
private String mLastText;
|
private String mLastText;
|
||||||
private String mDatePattern;
|
private String mDatePattern;
|
||||||
|
|
||||||
@@ -100,8 +101,9 @@ public class DateView extends TextView {
|
|||||||
protected void updateClock() {
|
protected void updateClock() {
|
||||||
if (mDateFormat == null) {
|
if (mDateFormat == null) {
|
||||||
final Locale l = Locale.getDefault();
|
final Locale l = Locale.getDefault();
|
||||||
final String fmt = DateFormat.getBestDateTimePattern(l, mDatePattern);
|
DateFormat format = DateFormat.getInstanceForSkeleton(mDatePattern, l);
|
||||||
mDateFormat = new SimpleDateFormat(fmt, l);
|
format.setContext(DisplayContext.CAPITALIZATION_FOR_STANDALONE);
|
||||||
|
mDateFormat = format;
|
||||||
}
|
}
|
||||||
|
|
||||||
mCurrentTime.setTime(System.currentTimeMillis());
|
mCurrentTime.setTime(System.currentTimeMillis());
|
||||||
|
|||||||
Reference in New Issue
Block a user