void ReplaceCell(object sender, NotifyCollectionChangedEventArgs e)
        {
            var section    = sender as Section;
            var startIndex = RowIndexFromChildCollection(section, e.OldStartingIndex);
            var repCell    = e.NewItems[0] as Cell;

            this[startIndex] = new RowInfo {
                Section  = section,
                Cell     = repCell,
                ViewType = (ViewType)ViewTypes[repCell.GetType()],
            };

            _adapter.NotifyItemRangeChanged(startIndex, 1);
        }
Esempio n. 2
0
        void ReplaceCell(object sender, NotifyCollectionChangedEventArgs e)
        {
            var section    = sender as Section;
            var startIndex = RowIndexFromChildCollection(section, e.OldStartingIndex);
            var repCell    = e.NewItems[0] as Cell;

            this[startIndex] = new RowInfo {
                Section  = section,
                Cell     = repCell,
                ViewType = (ViewType)ViewTypes[repCell.GetType()],
            };

            // Stop animation.
            (_recyclerView.GetItemAnimator() as DefaultItemAnimator).SupportsChangeAnimations = false;

            _adapter.NotifyItemRangeChanged(startIndex, 1);

            new Handler().PostDelayed(() =>
            {
                // Restart animation.
                (_recyclerView.GetItemAnimator() as DefaultItemAnimator).SupportsChangeAnimations = true;
            }, 100);
        }