use of de.westnordost.streetcomplete.view.ListAdapter in project StreetComplete by westnordost.
the class AddCyclewayForm method createAdapter.
private ListAdapter<Cycleway> createAdapter(List<Cycleway> items, final OnCyclewaySelected callback) {
return new ListAdapter<Cycleway>(items) {
@Override
public ViewHolder<Cycleway> onCreateViewHolder(ViewGroup parent, int viewType) {
return new ViewHolder<Cycleway>(LayoutInflater.from(parent.getContext()).inflate(R.layout.labeled_icon_button_cell, parent, false)) {
@Override
protected void onBind(final Cycleway item) {
ImageView iconView = itemView.findViewById(R.id.imageView);
TextView textView = itemView.findViewById(R.id.textView);
iconView.setImageResource(item.getIconResId(isLeftHandTraffic()));
textView.setText(item.nameResId);
itemView.setOnClickListener(view -> callback.onCyclewaySelected(item));
}
};
}
};
}
Aggregations