public override View GetView(int position, View convertView, ViewGroup parent) { EventViewHolder viewHolder; if (convertView == null) { viewHolder = new EventViewHolder(); convertView = context.LayoutInflater.Inflate(Resource.Layout.ProfileFragmentItem, parent, false); viewHolder.ivUserPhoto = convertView.FindViewById <ImageView>(Resource.Id.ivPFIUserPhoto); viewHolder.ivChat = convertView.FindViewById <ImageView>(Resource.Id.ivPFIEventChat); viewHolder.ivMore = convertView.FindViewById <ImageView>(Resource.Id.ivPFIEventMore); viewHolder.rvEventPhoto = convertView.FindViewById <RecyclerView>(Resource.Id.rvPFIEventPhoto); viewHolder.tvUserName = convertView.FindViewById <TextView>(Resource.Id.tvPFIUserName); viewHolder.tvEventTime = convertView.FindViewById <TextView>(Resource.Id.tvPFIEventTime); viewHolder.tvEventName = convertView.FindViewById <TextView>(Resource.Id.tvPFIEventName); viewHolder.llEventName = convertView.FindViewById <LinearLayout>(Resource.Id.llPFEventName); convertView.Tag = viewHolder; } else { viewHolder = convertView.Tag as EventViewHolder; } viewHolder.ivMore.Visibility = ViewStates.Invisible; var item = listOfEvent[position]; RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.Horizontal, false); viewHolder.rvEventPhoto.SetLayoutManager(layoutManager); var madapter = new HomeItemPrivateEventPhotoAdapter(item.listFiles, item.EventID, context); viewHolder.rvEventPhoto.SetAdapter(madapter); Picasso.With(context).Load(item.creatorpic).Placeholder(Resource.Drawable.contact_withoutphoto) .Transform(new CircleTransformation()).CenterCrop() .Resize(150, 150).Into(viewHolder.ivUserPhoto); viewHolder.tvEventName.Text = item.EventName; viewHolder.tvEventTime.Text = item.EventDate.ToString(); viewHolder.tvUserName.Text = item.creatorname; viewHolder.llEventName.SetOnClickListener(new llEventNameClickListner(viewHolder.llEventName, context, item.EventID)); viewHolder.ivChat.SetOnClickListener(new ivChatOnClickListner(viewHolder.ivMore, context, item.EventID)); return(convertView); }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { var item = listPublicEvent[position]; var viewholder = holder as PrivateEventViewHolder; RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.Horizontal, false); viewholder.rvEventPhoto.SetLayoutManager(layoutManager); var madapter = new HomeItemPrivateEventPhotoAdapter(item.listFiles, item.EventID, context); viewholder.rvEventPhoto.SetAdapter(madapter); Picasso.With(context).Load(item.creatorpic).Placeholder(Resource.Drawable.contact_withoutphoto) .Transform(new CircleTransformation()).CenterCrop() .Resize(150, 150).Into(viewholder.ivUserPhoto); viewholder.tvEventName.Text = item.EventName; viewholder.tvEventTime.Text = item.EventDate.ToString(); viewholder.tvEventDetails.Text = item.EventName; viewholder.tvUserName.Text = item.creatorname; viewholder.llEventName.SetOnClickListener(new llEventNameClickListner(viewholder.llEventName, context, item.EventID)); viewholder.ivChat.SetOnClickListener(new ivChatOnClickListner(viewholder.ivMore, context, item.EventID)); }