use of de.westnordost.streetcomplete.view.ImageSelectAdapter in project StreetComplete by westnordost.
the class ImageListQuestAnswerFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
View contentView = setContentView(R.layout.quest_generic_list);
valueList = contentView.findViewById(R.id.listSelect);
GridLayoutManager lm = new GridLayoutManager(getActivity(), getItemsPerRow());
valueList.setLayoutManager(lm);
valueList.setNestedScrollingEnabled(false);
showMoreButton = view.findViewById(R.id.buttonShowMore);
showMoreButton.setOnClickListener(v -> {
List<Item> all = Arrays.asList(getItems());
imageSelector.addItems(all.subList(imageSelector.getItemCount(), all.size()));
showMoreButton.setVisibility(View.GONE);
});
int selectableItems = getMaxSelectableItems();
TextView selectHint = view.findViewById(R.id.selectHint);
selectHint.setText(selectableItems == 1 ? R.string.quest_roofShape_select_one : R.string.quest_select_hint);
imageSelector = new ImageSelectAdapter(selectableItems);
return view;
}
Aggregations