public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { EventViewHolder vh = holder as EventViewHolder; vh.textTitle.Text = "#" + mEvents[position].NroEvento.ToString() + " " + mEvents[position].Titulo; vh.textDate.Text = mEvents[position].Fecha.ToString(AysaConstants.FormatDate); vh.textUser.Text = mEvents[position].Usuario.NombreApellido; vh.textLocation.Text = mEvents[position].Lugar; vh.textStatus.Text = mEvents[position].Estado == 1 ? "Abierto" : "Cerrado"; Event ev = mEvents[position]; // Config style for close events if (mEvents[position].Estado == 2) { vh.textTitle.SetTextColor(Color.ParseColor("#545459")); vh.textStatus.SetTextColor(Color.ParseColor("#545459")); vh.textStatus.SetBackgroundResource(Resource.Drawable.round_status_close); vh.textStatus.SetCompoundDrawablesWithIntrinsicBounds(Resource.Drawable.close_folder_event, 0, 0, 0); vh.separatorLine.SetBackgroundColor(Color.ParseColor("#9D9CA3")); vh.verticalLine.SetBackgroundColor(Color.ParseColor("#9D9CA3")); } }
// Raise an event when the item-click takes place: void OnClick(EventViewHolder viewHolder) { int position = viewHolder.AdapterPosition; Event ev = mEvents[position]; if (ItemClick != null) { ItemClick(this, ev); } }
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.EventCardView, parent, false); EventViewHolder vh = new EventViewHolder(itemView); Typeface iconFont = FontManager.getTypeface(parent.Context, FontManager.FONTAWESOME); vh.textIconLocation.Typeface = iconFont; vh.textIconUser.Typeface = iconFont; vh.textIconDate.Typeface = iconFont; vh.ItemView.Click += (sender, e) => OnClick(vh); return(vh); }