use of de.westnordost.streetcomplete.view.Item 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;
}
use of de.westnordost.streetcomplete.view.Item in project StreetComplete by westnordost.
the class PriorityList method buildList.
public static List<Item> buildList(List<Item> allItems, List<String> popularNames) {
// in reverse because the first element in the list should be first in religionsList
for (int i = popularNames.size() - 1; i >= 0; --i) {
String popularReligionName = popularNames.get(i);
for (int j = 0; j < allItems.size(); ++j) {
Item processed = allItems.get(j);
if (processed.value.equals(popularReligionName)) {
// shuffle to start of list
allItems.remove(j);
allItems.add(0, processed);
break;
}
}
}
return allItems;
}
use of de.westnordost.streetcomplete.view.Item in project StreetComplete by westnordost.
the class AddRoadSurfaceForm method onClickOk.
@Override
protected void onClickOk() {
final Bundle answer = new Bundle();
Item surface = getSelectedItem();
if (surface != null) {
answer.putString(SURFACE, surface.value);
if (surface.isGroup()) {
new AlertDialogBuilder(getContext()).setMessage(R.string.quest_surface_generic_surface_confirmation).setNegativeButton(R.string.quest_generic_confirmation_no, null).setPositiveButton(R.string.quest_generic_confirmation_yes, (dialog, which) -> applyFormAnswer(answer)).show();
return;
}
}
applyFormAnswer(answer);
}
Aggregations