use of libcore.icu.LocaleData in project platform_frameworks_base by android.
the class TimePickerSpinnerDelegate method getAmPmStrings.
public static String[] getAmPmStrings(Context context) {
String[] result = new String[2];
LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale);
result[0] = d.amPm[0].length() > 4 ? d.narrowAm : d.amPm[0];
result[1] = d.amPm[1].length() > 4 ? d.narrowPm : d.amPm[1];
return result;
}
use of libcore.icu.LocaleData in project platform_frameworks_base by android.
the class TextClock method chooseFormat.
/**
* Selects either one of {@link #getFormat12Hour()} or {@link #getFormat24Hour()}
* depending on whether the user has selected 24-hour format.
*
* @param handleTicker true if calling this method should schedule/unschedule the
* time ticker, false otherwise
*/
private void chooseFormat(boolean handleTicker) {
final boolean format24Requested = is24HourModeEnabled();
LocaleData ld = LocaleData.get(getContext().getResources().getConfiguration().locale);
if (format24Requested) {
mFormat = abc(mFormat24, mFormat12, ld.timeFormat_Hm);
mDescFormat = abc(mDescFormat24, mDescFormat12, mFormat);
} else {
mFormat = abc(mFormat12, mFormat24, ld.timeFormat_hm);
mDescFormat = abc(mDescFormat12, mDescFormat24, mFormat);
}
boolean hadSeconds = mHasSeconds;
mHasSeconds = DateFormat.hasSeconds(mFormat);
if (handleTicker && mRegistered && hadSeconds != mHasSeconds) {
if (hadSeconds)
getHandler().removeCallbacks(mTicker);
else
mTicker.run();
}
}
use of libcore.icu.LocaleData in project platform_frameworks_base by android.
the class TextClock method init.
private void init() {
if (mFormat12 == null || mFormat24 == null) {
LocaleData ld = LocaleData.get(getContext().getResources().getConfiguration().locale);
if (mFormat12 == null) {
mFormat12 = ld.timeFormat_hm;
}
if (mFormat24 == null) {
mFormat24 = ld.timeFormat_Hm;
}
}
createTime(mTimeZone);
// Wait until registering for events to handle the ticker
chooseFormat(false);
}
use of libcore.icu.LocaleData in project android_frameworks_base by crdroidandroid.
the class TextClock method chooseFormat.
/**
* Selects either one of {@link #getFormat12Hour()} or {@link #getFormat24Hour()}
* depending on whether the user has selected 24-hour format.
*
* @param handleTicker true if calling this method should schedule/unschedule the
* time ticker, false otherwise
*/
private void chooseFormat(boolean handleTicker) {
final boolean format24Requested = is24HourModeEnabled();
LocaleData ld = LocaleData.get(getContext().getResources().getConfiguration().locale);
if (format24Requested) {
mFormat = abc(mFormat24, mFormat12, ld.timeFormat_Hm);
mDescFormat = abc(mDescFormat24, mDescFormat12, mFormat);
} else {
mFormat = abc(mFormat12, mFormat24, ld.timeFormat_hm);
mDescFormat = abc(mDescFormat12, mDescFormat24, mFormat);
}
boolean hadSeconds = mHasSeconds;
mHasSeconds = DateFormat.hasSeconds(mFormat);
if (handleTicker && mRegistered && hadSeconds != mHasSeconds) {
if (hadSeconds)
getHandler().removeCallbacks(mTicker);
else
mTicker.run();
}
}
use of libcore.icu.LocaleData in project android_frameworks_base by crdroidandroid.
the class DateUtils method getMonthString.
/**
* Return a localized string for the month of the year.
* @param month One of {@link Calendar#JANUARY Calendar.JANUARY},
* {@link Calendar#FEBRUARY Calendar.FEBRUARY}, etc.
* @param abbrev One of {@link #LENGTH_LONG}, {@link #LENGTH_MEDIUM},
* or {@link #LENGTH_SHORTEST}.
* Undefined lengths will return {@link #LENGTH_MEDIUM}
* but may return something different in the future.
* @return Localized month of the year.
* @deprecated Use {@link java.text.SimpleDateFormat} instead.
*/
@Deprecated
public static String getMonthString(int month, int abbrev) {
LocaleData d = LocaleData.get(Locale.getDefault());
String[] names;
switch(abbrev) {
case LENGTH_LONG:
names = d.longMonthNames;
break;
case LENGTH_MEDIUM:
names = d.shortMonthNames;
break;
case LENGTH_SHORT:
names = d.shortMonthNames;
break;
case LENGTH_SHORTER:
names = d.shortMonthNames;
break;
case LENGTH_SHORTEST:
names = d.tinyMonthNames;
break;
default:
names = d.shortMonthNames;
break;
}
return names[month];
}
Aggregations