Search in sources :

Example 1 with NewPoiTypeSelected

use of io.jawg.osmcontributor.ui.events.map.NewPoiTypeSelected in project osm-contributor by jawg.

the class PoiTypePickerAdapter method getView.

@Override
public View getView(int position, View view, ViewGroup parent) {
    ViewHolder holder = null;
    if (view != null) {
        holder = (ViewHolder) view.getTag();
        if (holder instanceof ExpertViewHolder ^ expertMode) {
            holder = null;
        }
    }
    if (holder == null) {
        if (expertMode) {
            view = inflater.inflate(R.layout.single_expert_poitype_autocomplete_layout, parent, false);
            holder = new ExpertViewHolder(view);
        } else {
            view = inflater.inflate(R.layout.single_poitype_autocomplete_layout, parent, false);
            holder = new ViewHolder(view);
        }
        view.setTag(holder);
    }
    final PoiType value = filteredValues.get(position);
    holder.onBind(value);
    view.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            eventBus.post(new NewPoiTypeSelected(value));
            closeKeyboard();
        }
    });
    return view;
}
Also used : PoiType(io.jawg.osmcontributor.model.entities.PoiType) NewPoiTypeSelected(io.jawg.osmcontributor.ui.events.map.NewPoiTypeSelected) ImageView(android.widget.ImageView) BindView(butterknife.BindView) TextView(android.widget.TextView) View(android.view.View)

Aggregations

View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 PoiType (io.jawg.osmcontributor.model.entities.PoiType)1 NewPoiTypeSelected (io.jawg.osmcontributor.ui.events.map.NewPoiTypeSelected)1