private int move(MoveRowToNewSectionCollectionChange <TModel> change) { remove(change.OldIndex); tableView.InsertSections(indexSet(change.Index), UITableViewRowAnimation.Automatic); tableView.InsertRows(new SectionedIndex(change.Index, 0).ToIndexPaths(), UITableViewRowAnimation.Automatic); return(change.OldIndex.Section); }
private int?move(MoveRowToNewSectionCollectionChange <TModel> change) { var oldSectionWasRemoved = remove(change.OldIndex); tableView.InsertSections(indexSet(change.Index), UITableViewRowAnimation.Automatic); tableView.InsertRows(new SectionedIndex(change.Index, 0).ToIndexPaths(), UITableViewRowAnimation.Automatic); if (oldSectionWasRemoved) { return(null); } return(change.Index <= change.OldIndex.Section ? change.OldIndex.Section + 1 : change.OldIndex.Section); }
private void moveRowToNewSection(MoveRowToNewSectionCollectionChange <TModel> moveRowToNewSection) { var oldIndexToBeRemoved = mapSectionIndexToAdapterIndex(moveRowToNewSection.OldIndex); var sectionsCountBeforeUpdate = sectionsIndexes.Count; updateSectionIndexes(); var oldSectionWasDeleted = sectionsCountBeforeUpdate == sectionsIndexes.Count; if (oldSectionWasDeleted) { NotifyItemRangeRemoved(oldIndexToBeRemoved - 1, 2); } else { NotifyItemRemoved(oldIndexToBeRemoved); } var newSectionIndex = sectionsIndexes[moveRowToNewSection.Index] + HeaderOffset; NotifyItemRangeInserted(newSectionIndex, 2); }