@Test public void whenClickOneElementTwice_shouldThatElementRemainSelectedInSelectOneButtonsMode() { List<SelectChoice> items = getTestChoices(); setUpFormEntryPrompt(items, ""); SelectItemClickListener listener = mock(SelectItemClickListener.class); SelectOneListAdapter adapter = new SelectOneListAdapter(null, listener, activityController.get(), items, formEntryPrompt, null, null, 0, 1, false); recyclerView.initRecyclerView(adapter, false); clickChoice(0); assertThat(isItemSelected(0), is(true)); assertThat(isItemSelected(1), is(false)); clickChoice(0); assertThat(isItemSelected(0), is(true)); assertThat(isItemSelected(1), is(false)); }
public void initRecyclerView(AbstractSelectListAdapter adapter, boolean isFlex) { if (isFlex) { enableFlexboxLayout(); } else { enableGridLayout(adapter.getNumColumns()); } setAdapter(adapter); adjustRecyclerViewSize(); }
ChoicesRecyclerView extends RecyclerView { public void initRecyclerView(AbstractSelectListAdapter adapter, boolean isFlex) { if (isFlex) { enableFlexboxLayout(); } else { enableGridLayout(adapter.getNumColumns()); } setAdapter(adapter); adjustRecyclerViewSize(); } }
ChoicesRecyclerView extends RecyclerView { public void initRecyclerView(AbstractSelectListAdapter adapter, boolean isFlex) { if (isFlex) { enableFlexboxLayout(); } else { enableGridLayout(adapter.getNumColumns()); } setAdapter(adapter); adjustRecyclerViewSize(); } ChoicesRecyclerView(@NonNull Context context);  ChoicesRecyclerView(Context context, AttributeSet attrs); }
ChoicesRecyclerView extends RecyclerView { public void initRecyclerView(AbstractSelectListAdapter adapter, boolean isFlex) { if (isFlex) { enableFlexboxLayout(); } else { enableGridLayout(adapter.getNumColumns()); } setAdapter(adapter); adjustRecyclerViewSize(); } ChoicesRecyclerView(@NonNull Context context);  ChoicesRecyclerView(Context context, AttributeSet attrs); void initRecyclerView(AbstractSelectListAdapter adapter, boolean isFlex); }
ChoicesRecyclerView extends RecyclerView { public void initRecyclerView(AbstractSelectListAdapter adapter, boolean isFlex) { if (isFlex) { enableFlexboxLayout(); } else { enableGridLayout(adapter.getNumColumns()); } setAdapter(adapter); adjustRecyclerViewSize(); } ChoicesRecyclerView(@NonNull Context context);  ChoicesRecyclerView(Context context, AttributeSet attrs); void initRecyclerView(AbstractSelectListAdapter adapter, boolean isFlex);  }