use of org.odk.collect.android.widgets.items.ListWidget in project collect by opendatakit.
the class WidgetFactory method getSelectOneWidget.
private QuestionWidget getSelectOneWidget(String appearance, QuestionDetails questionDetails) {
final QuestionWidget questionWidget;
boolean isQuick = appearance.contains(Appearances.QUICK);
// considered in each widget by calls to ExternalDataUtil.getSearchXPathExpression.
if (appearance.contains(Appearances.MINIMAL)) {
questionWidget = new SelectOneMinimalWidget(activity, questionDetails, isQuick, waitingForDataRegistry);
} else if (appearance.contains(Appearances.LIKERT)) {
questionWidget = new LikertWidget(activity, questionDetails);
} else if (appearance.contains(Appearances.LIST_NO_LABEL)) {
questionWidget = new ListWidget(activity, questionDetails, false, isQuick);
} else if (appearance.contains(Appearances.LIST)) {
questionWidget = new ListWidget(activity, questionDetails, true, isQuick);
} else if (appearance.contains(Appearances.LABEL)) {
questionWidget = new LabelWidget(activity, questionDetails);
} else if (appearance.contains(Appearances.IMAGE_MAP)) {
questionWidget = new SelectOneImageMapWidget(activity, questionDetails, isQuick);
} else {
questionWidget = new SelectOneWidget(activity, questionDetails, isQuick);
}
return questionWidget;
}
use of org.odk.collect.android.widgets.items.ListWidget in project collect by opendatakit.
the class WidgetFactoryTest method testCreatingSelectOneListWidget.
@Test
public void testCreatingSelectOneListWidget() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_ONE).withAppearance("something LisT something").build();
QuestionWidget widget = widgetFactory.createWidgetFromPrompt(prompt, null);
assertThat(widget, instanceOf(ListWidget.class));
assertThat(((ListWidget) widget).shouldDisplayLabel(), is(true));
}
use of org.odk.collect.android.widgets.items.ListWidget in project collect by opendatakit.
the class WidgetFactoryTest method testCreatingSelectOneListNoLabelWidget.
@Test
public void testCreatingSelectOneListNoLabelWidget() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_ONE).withAppearance("something LisT-nOLabeL something").build();
QuestionWidget widget = widgetFactory.createWidgetFromPrompt(prompt, null);
assertThat(widget, instanceOf(ListWidget.class));
assertThat(((ListWidget) widget).shouldDisplayLabel(), is(false));
}
Aggregations