-
Notifications
You must be signed in to change notification settings - Fork 184
Steps for migration to 3.0
Vitaly Vivchar edited this page Oct 21, 2019
·
16 revisions
Step 1: Replace DiffCallback
to DefaultDiffCallback
public class YourDiffCallback
- extends DiffCallback<ViewModel> {
+ extends DefaultDiffCallback<ViewModel> {
- public boolean areContentsTheSame(ViewModel oldItemPosition, ViewModel newItemPosition) {
- return oldItemPosition.equals(newItemPosition);
- }
- public Object getChangePayload(int oldItemPosition, int newItemPosition) {
- final ViewModel newItem = mNewItems.get(newItemPosition);
- final ViewModel oldItem = mOldItems.get(oldItemPosition);
-
+ public Object getChangePayload(ViewModel oldItem, ViewModel newItem) {
//your code
- return super.getChangePayload(oldItemPosition, newItemPosition);
+ return super.getChangePayload(oldItem, newItem);
}
}