Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gabornovakp/b4273a66a37c7eca034c74c15ff7e8a5 to your computer and use it in GitHub Desktop.
Save gabornovakp/b4273a66a37c7eca034c74c15ff7e8a5 to your computer and use it in GitHub Desktop.
RevocableShareLink DiffUtilCallback
public class RevocableShareLinkInfoDiffUtilCallback extends DiffUtil.Callback {
List<RevocableShareLinkInfo> oldList;
List<RevocableShareLinkInfo> newList;
RevocableShareLinkInfoDiffUtilCallback(List<RevocableShareLinkInfo> newList, List<RevocableShareLinkInfo> oldList) {
this.newList = newList;
this.oldList = oldList;
}
@Override
public int getOldListSize() {
return oldList.size();
}
@Override
public int getNewListSize() {
return newList.size();
}
@Override
public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
return oldList.get(oldItemPosition).getLinkId().equals(newList.get(newItemPosition).getLinkId());
}
@Override
public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
return oldList.get(oldItemPosition).getName().equals(newList.get(newItemPosition).getName());
}
@Nullable
@Override
public Object getChangePayload(int oldItemPosition, int newItemPosition) {
return super.getChangePayload(oldItemPosition, newItemPosition);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment