public void UpdateData(IList <CompositeTypeItem> types) { DiffUtil.DiffResult result = DiffUtil.CalculateDiff( new TypedDiffUtilCallback <CompositeTypeItem>(this.types.ToArray(), types.ToArray())); this.types = types.ToList(); result.DispatchUpdatesTo(this); }
public void UpdateData(IList <SymbologySettingsItem> symbologyDescriptions) { DiffUtil.DiffResult result = DiffUtil.CalculateDiff( new TypedDiffUtilCallback <SymbologySettingsItem>(this.symbologyDescriptions.ToArray(), symbologyDescriptions.ToArray())); this.symbologyDescriptions = symbologyDescriptions; result.DispatchUpdatesTo(this); }
public void UpdateData(IList <LocationType> locationTypes) { DiffUtil.DiffResult result = DiffUtil.CalculateDiff( new TypedDiffUtilCallback <LocationType>(this.locationTypes.ToArray(), locationTypes.ToArray())); this.locationTypes = locationTypes; result.DispatchUpdatesTo(this); }
public void UpdateData(IList <CameraSettingsPositionItem> cameraPositions) { var diff = new TypedDiffUtilCallback <CameraSettingsPositionItem>(this.cameraPositions.ToArray(), cameraPositions.ToArray()); DiffUtil.DiffResult result = DiffUtil.CalculateDiff(diff); this.cameraPositions = cameraPositions; result.DispatchUpdatesTo(this); }
public void UpdateData(IList <ViewfinderType> types) { DiffUtil.DiffResult result = DiffUtil.CalculateDiff( new TypedDiffUtilCallback <ViewfinderType>(this.types.ToArray(), types.ToArray()) ); this.types = types; result.DispatchUpdatesTo(this); }
private DiffUtil.DiffResult calculateDiffFromCurrentItems(IReadOnlyList <FlatItemInfo> newImmutableItems) { return(DiffUtil.CalculateDiff( new HeaderOffsetAwareDiffCallback(currentItems, newImmutableItems, AreItemContentsTheSame, AreSectionsRepresentationsTheSame, HeaderOffset) )); }
public virtual void UpdateList(List <TAdapterModel> newDataset) { DiffCallback <TAdapterModel> diffCallback = new DiffCallback <TAdapterModel>(DataSet, newDataset); DiffUtil.DiffResult diffResult = DiffUtil.CalculateDiff(diffCallback); diffResult.DispatchUpdatesTo(this); DataSet.Clear(); DataSet.AddRange(newDataset); }
public void UpdateData(MeasureUnitItem[] measureUnits) { if (measureUnits == null) { return; } DiffUtil.DiffResult result = DiffUtil.CalculateDiff(new TypedDiffUtilCallback <MeasureUnitItem>(this.measureUnits, measureUnits)); this.measureUnits = measureUnits; result.DispatchUpdatesTo(this); }
public void UpdateData(IList <SymbologyItem> items) { if (items == null) { return; } DiffUtil.DiffResult result = DiffUtil.CalculateDiff( new TypedDiffUtilCallback <SymbologyItem>(this.symbologyItems.ToArray(), items.ToArray())); this.symbologyItems = items; result.DispatchUpdatesTo(this); }
public virtual void SwapItems(IList <IList <ICell> > newItems, int column) { IList <IList <ICell> > oldItems = mCellRecyclerViewAdapter.GetItems(); // Set new items without calling notifyCellDataSetChanged method of CellRecyclerViewAdapter mCellRecyclerViewAdapter.SetItems((IList <IList <Adapter.ICell> >)newItems, !mEnableAnimation); if (mEnableAnimation) { // Find the differences between old cell items and new items. ColumnSortCallback diffCallback = new ColumnSortCallback(oldItems, newItems, column); DiffUtil.DiffResult diffResult = DiffUtil.CalculateDiff(diffCallback); diffResult.DispatchUpdatesTo(mCellRecyclerViewAdapter); diffResult.DispatchUpdatesTo(mRowHeaderRecyclerViewAdapter); } }
private Task DeleteItemsAsync(IEnumerable <int> indexes) { // unfortunately removing the indexes the same way like they are added in InsertItemsAsync() // results in a crash for some selected indexes, so DiffUtil comes to the rescue var oldIndexes = Enumerable.Range(0, ItemCount).ToArray(); var newIndexes = oldIndexes.Except(indexes).ToArray(); var callback = new IndexDiffUtilCallback(oldIndexes, newIndexes); var adapterDiff = DiffUtil.CalculateDiff(callback); ItemCount = newIndexes.Length; InvokeHeightWillChange(); adapterDiff.DispatchUpdatesTo(_recyclerView.GetAdapter()); return(Task.Delay(TimeSpan.FromMilliseconds(300))); }
private void processUpdate(IList <CalendarItem> calendarItems, bool hasCalendarsLinked) { var handler = new Handler(Looper.MainLooper); new Thread(() => { var oldItems = items; var oldAnchors = anchors; var newItems = calendarItems; var newAnchors = layoutAnchorsCalculator.CalculateAnchors(newItems, hasCalendarsLinked); var diffResult = DiffUtil.CalculateDiff(new AnchorDiffCallback(oldItems, oldAnchors, newItems, newAnchors)); handler.Post(() => dispatchUpdates(newItems, newAnchors, diffResult)); }).Start(); }
private void UpdateRecyclerView() { MainThread.BeginInvokeOnMainThread(() => { if (OldList != null) { DiffUtil.DiffResult diffResult = DiffUtil.CalculateDiff(new DiffCallBack(_app, OldList, _app.ListMs), true); diffResult.DispatchUpdatesTo(_readerReadAdapter); } OldList.Clear(); for (int i = 0; i < _app.ListMs.Count; i++) { Dictionary <string, string> m = (Dictionary <string, string>)((Dictionary <string, string>)_app.ListMs[i]); OldList.Add(m); } }); }
public void UpdateList(List <Machine> newList) { if (!_machines.Any()) { _machines.AddRange(newList); NotifyDataSetChanged(); } else { DiffUtil.DiffResult result = DiffUtil.CalculateDiff(new MachineDiffCallback(_machines, newList), true); _machines.Clear(); _machines = null; _machines = newList; result.DispatchUpdatesTo(this); } }
private void SwapItems(IList <IList <ICell> > oldItems, IList <IList <ICell> > newItems, int column, IList <IRowHeader> newRowHeader, SortState sortState) { // Set new items without calling notifyCellDataSetChanged method of CellRecyclerViewAdapter mCellRecyclerViewAdapter.SetItems(newItems, !mEnableAnimation); mRowHeaderRecyclerViewAdapter.SetItems(newRowHeader, !mEnableAnimation); if (mEnableAnimation) { // Find the differences between old cell items and new items. ColumnSortCallback diffCallback = new ColumnSortCallback(oldItems, newItems, column); DiffUtil.DiffResult diffResult = DiffUtil.CalculateDiff(diffCallback); diffResult.DispatchUpdatesTo(mCellRecyclerViewAdapter); diffResult.DispatchUpdatesTo(mRowHeaderRecyclerViewAdapter); } foreach (ColumnSortStateChangedListener listener in columnSortStateChangedListeners) { listener.OnColumnSortStatusChanged(column, sortState); } }