// populates the properties of the child views of the itemView public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { // instantiate a new view holder var viewHolder = holder as InformesViewHolder; // get an item by position (index) Informes informe = informesColeccion[position]; // assign values to the views' text properties if (viewHolder == null) { return; } viewHolder.NombreInforme.Text = informe.NombreInforme; viewHolder.DescripcionInformeView.Text = informe.DescripcionInforme; using (Bitmap imagenCircular = HelperMethods.redondearImagen(BitmapFactory.DecodeResource(currentActivity.Resources, Resource.Mipmap.Informe_Lista), 200, 200)) { viewHolder.InformesPhotoImageView.SetImageBitmap(imagenCircular); } // set the Tag property of the AcquaintanceRow view to the position (index) of the item that is currently being bound. We'll need it later in the OnLick() implementation. viewHolder.InformeRow.Tag = position; // set OnClickListener of AcquaintanceRow viewHolder.InformeRow.SetOnClickListener(this); }
void moveItem(int fromPosition, int toPosition) { Informes model = informesColeccion[fromPosition]; informesColeccion.RemoveAt(fromPosition); informesColeccion.Insert(toPosition, model); NotifyItemMoved(fromPosition, toPosition); }
Informes removeItem(int position) { Informes model = informesColeccion[position]; informesColeccion.RemoveAt(position); NotifyItemRemoved(position); return(model); }
void applyAndAnimateAdditions(List <Informes> newModels) { for (int i = 0, count = newModels.Count(); i < count; i++) { Informes model = newModels[i]; if (!informesColeccion.Contains(model)) { addItem(i, model); } } }
void applyAndAnimateRemovals(List <Informes> newModels) { for (int i = informesColeccion.Count() - 1; i >= 0; i--) { Informes model = informesColeccion[i]; if (!newModels.Contains(model)) { removeItem(i); } } }
void applyAndAnimateMovedItems(List <Informes> newModels) { for (int toPosition = newModels.Count() - 1; toPosition >= 0; toPosition--) { Informes model = newModels[toPosition]; int fromPosition = informesColeccion.IndexOf(model); if (fromPosition >= 0 && fromPosition != toPosition) { moveItem(fromPosition, toPosition); } } }
void addItem(int position, Informes model) { informesColeccion.Insert(position, model); NotifyItemInserted(position); }