DiffCallback


abstract class DiffCallback<Value>

Known direct subclasses
GuidedActionDiffCallback

DiffCallback used for GuidedActions, see setActionsDiffCallback.


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 functions

abstract Boolean
areContentsTheSame(oldItem: Value, newItem: Value)

Called to decide whether two items have the same data.

abstract Boolean
areItemsTheSame(oldItem: Value, newItem: Value)

Called to decide whether two objects represent the same item.

Any?
getChangePayload(oldItem: Value, newItem: Value)

Called to get a change payload between an old and new version of an item.

Public constructors

DiffCallback

Added in 1.1.0
DiffCallback()

Public functions

areContentsTheSame

Added in 1.1.0
abstract fun areContentsTheSame(oldItem: Value, newItem: Value): Boolean

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
oldItem: Value

The item in the old list.

newItem: Value

The item in the new list.

Returns
Boolean

True if the contents of the items are the same or false if they are different.

areItemsTheSame

Added in 1.1.0
abstract fun areItemsTheSame(oldItem: Value, newItem: Value): Boolean

Called to decide whether two objects represent the same item.

Parameters
oldItem: Value

The item in the old list.

newItem: Value

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

Added in 1.1.0
fun getChangePayload(oldItem: Value, newItem: Value): Any?

Called to get a change payload between an old and new version of an item.

See also
getChangePayload