use of org.fossasia.openevent.core.speaker.SpeakerViewHolder in project open-event-android by fossasia.
the class GlobalSearchAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
switch(holder.getItemViewType()) {
case TRACK:
TrackViewHolder trackSearchHolder = (TrackViewHolder) holder;
Track currentTrack = (Track) getItem(position);
trackSearchHolder.bindTrack(currentTrack);
break;
case SPEAKER:
SpeakerViewHolder speakerSearchHolder = (SpeakerViewHolder) holder;
Speaker speaker = (Speaker) getItem(position);
speakerSearchHolder.bindSpeaker(speaker);
break;
case LOCATION:
LocationViewHolder locationSearchHolder = (LocationViewHolder) holder;
Microlocation location = (Microlocation) getItem(position);
locationSearchHolder.bindLocation(location);
break;
case DIVIDER:
DividerViewHolder resultTypeViewHolder = (DividerViewHolder) holder;
String headerItem = (String) getItem(position);
resultTypeViewHolder.bindHeader(headerItem);
break;
case SESSION:
DayScheduleViewHolder bookmarkTypeViewHolder = (DayScheduleViewHolder) holder;
Session bookmarkItem = (Session) getItem(position);
bookmarkTypeViewHolder.setSession(bookmarkItem);
bookmarkTypeViewHolder.bindSession(realmRepo);
break;
default:
// If viewType is none of the above then nothing is done
break;
}
}
use of org.fossasia.openevent.core.speaker.SpeakerViewHolder in project open-event-android by fossasia.
the class GlobalSearchAdapter method onCreateViewHolder.
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
RecyclerView.ViewHolder resultHolder = null;
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
switch(viewType) {
case TRACK:
View track = inflater.inflate(R.layout.item_track, parent, false);
resultHolder = new TrackViewHolder(track, context);
break;
case SPEAKER:
View speaker = inflater.inflate(R.layout.search_item_speaker, parent, false);
resultHolder = new SpeakerViewHolder(speaker, context);
((SpeakerViewHolder) resultHolder).setIsImageCircle(true);
break;
case LOCATION:
View location = inflater.inflate(R.layout.item_location, parent, false);
resultHolder = new LocationViewHolder(location, context);
break;
case DIVIDER:
View header;
if (context instanceof SearchActivity) {
header = inflater.inflate(R.layout.search_result_type_header_format, parent, false);
} else {
header = inflater.inflate(R.layout.recycler_view_header, parent, false);
}
resultHolder = new DividerViewHolder(header);
break;
case SESSION:
View bookmark = inflater.inflate(R.layout.item_schedule, parent, false);
resultHolder = new DayScheduleViewHolder(bookmark, context, onBookmarkSelectedListener);
break;
default:
// If viewType doesn't match any of the above objects no view is created
break;
}
return resultHolder;
}
Aggregations