use of org.odk.collect.android.adapters.SelectOneListAdapter in project collect by opendatakit.
the class ChoicesRecyclerViewTest method whenFLexAppearanceIsUsed_shouldFlexboxLayoutManagerBeUsed.
@Test
public void whenFLexAppearanceIsUsed_shouldFlexboxLayoutManagerBeUsed() {
SelectOneListAdapter adapter = new SelectOneListAdapter(null, null, null, new ArrayList<>(), null, null, null, 0, 1, false, mock(MediaUtils.class));
initRecyclerView(adapter, true);
assertThat(recyclerView.getLayoutManager().getClass().getName(), equalTo(FlexboxLayoutManager.class.getName()));
}
use of org.odk.collect.android.adapters.SelectOneListAdapter in project collect by opendatakit.
the class ChoicesRecyclerViewTest method whenNonFLexAppearanceIsUsedWithMoreThanOneColumn_shouldNotDividersBeAdded.
@Test
public void whenNonFLexAppearanceIsUsedWithMoreThanOneColumn_shouldNotDividersBeAdded() {
List<SelectChoice> items = getTestChoices();
setUpFormEntryPrompt(items, "");
SelectOneListAdapter adapter = new SelectOneListAdapter(null, null, activityController.get(), items, formEntryPrompt, null, null, 0, 2, false, mock(MediaUtils.class));
initRecyclerView(adapter, false);
assertThat(recyclerView.getItemDecorationCount(), is(0));
}
use of org.odk.collect.android.adapters.SelectOneListAdapter in project collect by opendatakit.
the class SelectOneWidget method setUpAdapter.
@Override
protected AbstractSelectListAdapter setUpAdapter() {
int numColumns = Appearances.getNumberOfColumns(getFormEntryPrompt(), screenUtils);
boolean noButtonsMode = Appearances.isCompactAppearance(getFormEntryPrompt()) || Appearances.isNoButtonsAppearance(getFormEntryPrompt());
recyclerViewAdapter = new SelectOneListAdapter(getSelectedValue(), this, getContext(), items, getFormEntryPrompt(), getReferenceManager(), getAudioHelper(), getPlayColor(getFormEntryPrompt(), themeUtils), numColumns, noButtonsMode, mediaUtils);
return recyclerViewAdapter;
}
use of org.odk.collect.android.adapters.SelectOneListAdapter in project collect by opendatakit.
the class SelectOneWidget method setChoiceSelected.
@Override
public void setChoiceSelected(int choiceIndex, boolean isSelected) {
RadioButton button = new RadioButton(getContext());
button.setTag(choiceIndex);
button.setChecked(isSelected);
((SelectOneListAdapter) recyclerViewAdapter).onCheckedChanged(button, isSelected);
}
Aggregations