DiffCallback
public abstract class DiffCallback<Value>
GuidedActionDiffCallback |
DiffCallback used for GuidedActions, see |
Callback that informs ArrayObjectAdapter how to compute list updates when using DiffUtil in setItems method.
The setItems method will pass items from different lists to this callback in order to implement the DiffUtil.Callback it uses to compute differences between lists.
| Parameters | |
|---|---|
<Value> |
Type of items to compare. |
Summary
Public constructors |
|---|
Public methods |
|
|---|---|
abstract boolean |
areContentsTheSame(@NonNull Value oldItem, @NonNull Value newItem)Called to decide whether two items have the same data. |
abstract boolean |
areItemsTheSame(@NonNull Value oldItem, @NonNull Value newItem)Called to decide whether two objects represent the same item. |
@Nullable Object |
getChangePayload(@NonNull Value oldItem, @NonNull Value newItem)Called to get a change payload between an old and new version of an item. |
Public constructors
Public methods
areContentsTheSame
public abstract boolean areContentsTheSame(@NonNull Value oldItem, @NonNull Value newItem)
Called to decide whether two items have the same data. This information is used to detect if the contents of an item have changed.
| Parameters | |
|---|---|
@NonNull Value oldItem |
The item in the old list. |
@NonNull Value newItem |
The item in the new list. |
| Returns | |
|---|---|
boolean |
True if the contents of the items are the same or false if they are different. |
| See also | |
|---|---|
areContentsTheSame |
areItemsTheSame
public abstract boolean areItemsTheSame(@NonNull Value oldItem, @NonNull Value newItem)
Called to decide whether two objects represent the same item.
| Parameters | |
|---|---|
@NonNull Value oldItem |
The item in the old list. |
@NonNull Value newItem |
The item in the new list. |
| Returns | |
|---|---|
boolean |
True if the two items represent the same object or false if they are different. |
| See also | |
|---|---|
areItemsTheSame |
getChangePayload
public @Nullable Object getChangePayload(@NonNull Value oldItem, @NonNull Value newItem)
Called to get a change payload between an old and new version of an item.
| See also | |
|---|---|
getChangePayload |