Ejemplo n.º 1
0
 public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
 {
     if (holder is TCellViewHolder)
     {
         holder.SetData(DataSet [position]);
     }
 }
Ejemplo n.º 2
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            var data = DataSet [position];

            if (holder is TCellViewHolder)
            {
                holder.SetData(data, SelectedDataSet.Contains(data));
            }
        }
Ejemplo n.º 3
0
 // Replace the contents of a view (invoked by the layout manager)
 public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
 {
     // Get element from your dataset at this position and replace the contents of the view with that element
     if (holder is TCellViewHolder)
     {
         position -= 1;
         base.OnBindViewHolder(holder, position);
     }
     else if (holder is THeadViewHolder)
     {
         holder.SetData(HeadData);
     }
 }
Ejemplo n.º 4
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            //want to see if a) this item is selected, and b) if this selection is 'new' and needs to be (optionally) animated
            var selected         = selectedItemIndices.Contains(position);
            var animateSelection = lastSelectionIndex == position || clearingSelections && selected;             //was it just selected or are we clearing all selections?

            // Get element from your dataset at this position and replace the contents of the view with that element
            holder.SetData(dataSet [position], selected && !clearingSelections, animateSelection);

            //reset our selection tracking vars
            if (animateSelection)
            {
                lastSelectionIndex = -1;

                if (clearingSelections && selected)
                {
                    selectedItemIndices.Remove(position);
                }

                //see if we're done clearing selections
                clearingSelections &= selectedItemIndices.Count != 0;
            }
        }