use of org.odk.collect.android.logic.DatePickerDetails in project collect by opendatakit.
the class DateTimeUtilsTest method setUp.
@Before
public void setUp() {
gregorian = new DatePickerDetails(DatePickerDetails.DatePickerType.GREGORIAN, DatePickerDetails.DatePickerMode.CALENDAR);
gregorianSpinners = new DatePickerDetails(DatePickerDetails.DatePickerType.GREGORIAN, DatePickerDetails.DatePickerMode.SPINNERS);
gregorianMonthYear = new DatePickerDetails(DatePickerDetails.DatePickerType.GREGORIAN, DatePickerDetails.DatePickerMode.MONTH_YEAR);
gregorianYear = new DatePickerDetails(DatePickerDetails.DatePickerType.GREGORIAN, DatePickerDetails.DatePickerMode.YEAR);
ethiopian = new DatePickerDetails(DatePickerDetails.DatePickerType.ETHIOPIAN, DatePickerDetails.DatePickerMode.SPINNERS);
ethiopianMonthYear = new DatePickerDetails(DatePickerDetails.DatePickerType.ETHIOPIAN, DatePickerDetails.DatePickerMode.MONTH_YEAR);
ethiopianYear = new DatePickerDetails(DatePickerDetails.DatePickerType.ETHIOPIAN, DatePickerDetails.DatePickerMode.YEAR);
coptic = new DatePickerDetails(DatePickerDetails.DatePickerType.COPTIC, DatePickerDetails.DatePickerMode.SPINNERS);
copticMonthYear = new DatePickerDetails(DatePickerDetails.DatePickerType.COPTIC, DatePickerDetails.DatePickerMode.MONTH_YEAR);
copticYear = new DatePickerDetails(DatePickerDetails.DatePickerType.COPTIC, DatePickerDetails.DatePickerMode.YEAR);
islamic = new DatePickerDetails(DatePickerDetails.DatePickerType.ISLAMIC, DatePickerDetails.DatePickerMode.SPINNERS);
islamicMonthYear = new DatePickerDetails(DatePickerDetails.DatePickerType.ISLAMIC, DatePickerDetails.DatePickerMode.MONTH_YEAR);
islamicYear = new DatePickerDetails(DatePickerDetails.DatePickerType.ISLAMIC, DatePickerDetails.DatePickerMode.YEAR);
}
use of org.odk.collect.android.logic.DatePickerDetails in project collect by opendatakit.
the class DateTimeUtilsTest method setUp.
@Before
public void setUp() {
gregorianDatePickerDetails = new DatePickerDetails(DatePickerDetails.DatePickerType.GREGORIAN, DatePickerDetails.DatePickerMode.CALENDAR);
ethiopianDatePickerDetails = new DatePickerDetails(DatePickerDetails.DatePickerType.ETHIOPIAN, DatePickerDetails.DatePickerMode.SPINNERS);
copticDatePickerDetails = new DatePickerDetails(DatePickerDetails.DatePickerType.COPTIC, DatePickerDetails.DatePickerMode.SPINNERS);
islamicDatePickerDetails = new DatePickerDetails(DatePickerDetails.DatePickerType.ISLAMIC, DatePickerDetails.DatePickerMode.SPINNERS);
bikramSambatDatePickerDetails = new DatePickerDetails(DatePickerDetails.DatePickerType.BIKRAM_SAMBAT, DatePickerDetails.DatePickerMode.SPINNERS);
myanmarDatePickerDetails = new DatePickerDetails(DatePickerDetails.DatePickerType.MYANMAR, DatePickerDetails.DatePickerMode.SPINNERS);
persianDatePickerDetails = new DatePickerDetails(DatePickerDetails.DatePickerType.PERSIAN, DatePickerDetails.DatePickerMode.SPINNERS);
context = Collect.getInstance();
defaultLocale = Locale.getDefault();
defaultTimezone = TimeZone.getDefault();
}
use of org.odk.collect.android.logic.DatePickerDetails in project collect by opendatakit.
the class DialogFragmentHelpers method setUpDatePickerDetails.
public static DatePickerDetails setUpDatePickerDetails(DatePickerDetails.DatePickerType datePickerType) {
DatePickerDetails datePickerDetails = mock(DatePickerDetails.class);
when(datePickerDetails.getDatePickerType()).thenReturn(datePickerType);
when(datePickerDetails.isSpinnerMode()).thenReturn(true);
when(datePickerDetails.isMonthYearMode()).thenReturn(false);
when(datePickerDetails.isYearMode()).thenReturn(false);
return datePickerDetails;
}
use of org.odk.collect.android.logic.DatePickerDetails in project collect by opendatakit.
the class DateWidgetTest method whenPromptHasAnswer_answerTextViewShowsCorrectDate.
@Test
public void whenPromptHasAnswer_answerTextViewShowsCorrectDate() {
FormEntryPrompt prompt = promptWithQuestionDefAndAnswer(questionDef, new DateData(dateAnswer.toDate()));
DatePickerDetails datePickerDetails = DateTimeWidgetUtils.getDatePickerDetails(prompt.getQuestion().getAppearanceAttr());
DateWidget widget = createWidget(prompt);
assertEquals(widget.binding.dateAnswerText.getText(), DateTimeWidgetUtils.getDateTimeLabel(dateAnswer.toDate(), datePickerDetails, false, widget.getContext()));
}
use of org.odk.collect.android.logic.DatePickerDetails in project collect by opendatakit.
the class DateTimeWidgetTest method setDateData_updatesValueShownInDateAnswerTextView.
@Test
public void setDateData_updatesValueShownInDateAnswerTextView() {
FormEntryPrompt prompt = promptWithQuestionDefAndAnswer(questionDef, null);
DatePickerDetails datePickerDetails = DateTimeWidgetUtils.getDatePickerDetails(prompt.getQuestion().getAppearanceAttr());
DateTimeWidget widget = createWidget(prompt);
widget.setData(new LocalDateTime().withDate(2010, 5, 12));
assertEquals(widget.binding.dateWidget.dateAnswerText.getText(), DateTimeWidgetUtils.getDateTimeLabel(localDateTime.toDate(), datePickerDetails, false, widget.getContext()));
}
Aggregations