use of java.text.DateFormatSymbols in project android-betterpickers by code-troopers.
the class TimePicker method onFinishInflate.
@Override
protected void onFinishInflate() {
super.onFinishInflate();
View v1 = findViewById(R.id.first);
View v2 = findViewById(R.id.second);
View v3 = findViewById(R.id.third);
View v4 = findViewById(R.id.fourth);
mEnteredTime = (TimerView) findViewById(R.id.timer_time_text);
mDelete = (ImageButton) findViewById(R.id.delete);
mDelete.setOnClickListener(this);
mDelete.setOnLongClickListener(this);
mNumbers[1] = (Button) v1.findViewById(R.id.key_left);
mNumbers[2] = (Button) v1.findViewById(R.id.key_middle);
mNumbers[3] = (Button) v1.findViewById(R.id.key_right);
mNumbers[4] = (Button) v2.findViewById(R.id.key_left);
mNumbers[5] = (Button) v2.findViewById(R.id.key_middle);
mNumbers[6] = (Button) v2.findViewById(R.id.key_right);
mNumbers[7] = (Button) v3.findViewById(R.id.key_left);
mNumbers[8] = (Button) v3.findViewById(R.id.key_middle);
mNumbers[9] = (Button) v3.findViewById(R.id.key_right);
mLeft = (Button) v4.findViewById(R.id.key_left);
mNumbers[0] = (Button) v4.findViewById(R.id.key_middle);
mRight = (Button) v4.findViewById(R.id.key_right);
setLeftRightEnabled(false);
for (int i = 0; i < 10; i++) {
mNumbers[i].setOnClickListener(this);
mNumbers[i].setText(String.format("%d", i));
mNumbers[i].setTag(R.id.numbers_key, new Integer(i));
}
updateTime();
Resources res = mContext.getResources();
mAmpm = new DateFormatSymbols().getAmPmStrings();
if (mIs24HoursMode) {
mLeft.setText(res.getString(R.string.time_picker_00_label));
mRight.setText(res.getString(R.string.time_picker_30_label));
} else {
mLeft.setText(mAmpm[0]);
mRight.setText(mAmpm[1]);
}
mLeft.setOnClickListener(this);
mRight.setOnClickListener(this);
mAmPmLabel = (TextView) findViewById(R.id.ampm_label);
mAmPmState = AMPM_NOT_SELECTED;
mDivider = findViewById(R.id.divider);
restyleViews();
updateKeypad();
}
use of java.text.DateFormatSymbols in project jodd by oblac.
the class LocaleUtilTest method testLocaleUtil.
@Test
public void testLocaleUtil() {
Locale locale1 = LocaleUtil.getLocale("fr", "FR");
Locale locale2 = LocaleUtil.getLocale("fr_FR");
assertSame(locale1, locale2);
DateFormatSymbolsEx dfs = LocaleUtil.getDateFormatSymbols(locale2);
DateFormatSymbols dfsJava = new DateFormatSymbols(locale2);
assertEquals(dfs.getMonth(0), dfsJava.getMonths()[0]);
assertEquals(dfs.getWeekday(1), dfsJava.getWeekdays()[1]);
assertEquals(dfs.getShortMonth(2), dfsJava.getShortMonths()[2]);
locale1 = LocaleUtil.getLocale("en");
locale2 = LocaleUtil.getLocale("en_EN");
assertNotSame(locale1, locale2);
dfs = LocaleUtil.getDateFormatSymbols(locale2);
dfsJava = new DateFormatSymbols(locale2);
assertEquals(dfs.getMonth(0), dfsJava.getMonths()[0]);
assertEquals(dfs.getWeekday(1), dfsJava.getWeekdays()[1]);
assertEquals(dfs.getShortMonth(2), dfsJava.getShortMonths()[2]);
}
use of java.text.DateFormatSymbols in project CompactCalendarView by SundeepK.
the class WeekUtils method getWeekdayNames.
static String[] getWeekdayNames(Locale locale, int day, boolean useThreeLetterAbbreviation) {
DateFormatSymbols dateFormatSymbols = new DateFormatSymbols(locale);
String[] dayNames = dateFormatSymbols.getShortWeekdays();
if (dayNames == null) {
throw new IllegalStateException("Unable to determine weekday names from default locale");
}
if (dayNames.length != 8) {
throw new IllegalStateException("Expected weekday names from default locale to be of size 7 but: " + Arrays.toString(dayNames) + " with size " + dayNames.length + " was returned.");
}
String[] weekDayNames = new String[7];
String[] weekDaysFromSunday = { dayNames[1], dayNames[2], dayNames[3], dayNames[4], dayNames[5], dayNames[6], dayNames[7] };
for (int currentDay = day - 1, i = 0; i <= 6; i++, currentDay++) {
currentDay = currentDay >= 7 ? 0 : currentDay;
weekDayNames[i] = weekDaysFromSunday[currentDay];
}
if (!useThreeLetterAbbreviation) {
for (int i = 0; i < weekDayNames.length; i++) {
weekDayNames[i] = weekDayNames[i].substring(0, 1);
}
}
return weekDayNames;
}
use of java.text.DateFormatSymbols in project jdk8u_jdk by JetBrains.
the class TestZoneTextPrinterParser method parseText.
private void parseText(Set<String> zids, Locale locale, TextStyle style, boolean ci) {
System.out.println("---------------------------------------");
DateTimeFormatter fmt = getFormatter(locale, style, ci);
for (String[] names : new DateFormatSymbols(locale).getZoneStrings()) {
if (!zids.contains(names[0])) {
continue;
}
String zid = names[0];
String expected = ZoneName.toZid(zid, locale);
parse(fmt, zid, expected, zid, locale, style, ci);
int i = style == TextStyle.FULL ? 1 : 2;
for (; i < names.length; i += 2) {
parse(fmt, zid, expected, names[i], locale, style, ci);
}
}
}
use of java.text.DateFormatSymbols in project intellij-community by JetBrains.
the class CalendarView method fillMonths.
private void fillMonths() {
DateFormatSymbols dateFormatSymbols = new DateFormatSymbols(Locale.getDefault());
for (int i = Calendar.JANUARY; i <= Calendar.DECEMBER; i++) myMonths.addItem(dateFormatSymbols.getMonths()[i]);
myMonths.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
refresh();
}
});
}
Aggregations