Search in sources :

Example 1 with GroupedImageSelectAdapter

use of de.westnordost.streetcomplete.view.GroupedImageSelectAdapter in project StreetComplete by westnordost.

the class AddRoadSurfaceForm 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_street_surface);
    RecyclerView surfaceSelect = contentView.findViewById(R.id.surfaceSelect);
    GridLayoutManager lm = new GridLayoutManager(getActivity(), 3);
    surfaceSelect.setLayoutManager(lm);
    surfaceSelect.setNestedScrollingEnabled(false);
    imageSelector = new GroupedImageSelectAdapter(lm);
    imageSelector.setItems(Arrays.asList(TOP_SURFACES));
    surfaceSelect.setAdapter(imageSelector);
    Button showMoreButton = contentView.findViewById(R.id.buttonShowMore);
    showMoreButton.setOnClickListener(v -> {
        imageSelector.setItems(Arrays.asList(ALL_SURFACES));
        showMoreButton.setVisibility(View.GONE);
    });
    return view;
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) Button(android.widget.Button) GroupedImageSelectAdapter(de.westnordost.streetcomplete.view.GroupedImageSelectAdapter) RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Aggregations

GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 Button (android.widget.Button)1 GroupedImageSelectAdapter (de.westnordost.streetcomplete.view.GroupedImageSelectAdapter)1