Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in version 27.1.0
belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1

DiffCallback

public abstract class DiffCallback
extends Object

java.lang.Object
   ↳ android.support.v17.leanback.widget.DiffCallback<Value>
Known Direct Subclasses


Callback that informs ArrayObjectAdapter how to compute list updates when using DiffUtil in setItems(List, DiffCallback) method.

The setItems(List, DiffCallback) method will pass items from different lists to this callback in order to implement the DiffUtil.Callback it uses to compute differences between lists.

Summary

Public constructors

DiffCallback()

Public methods

abstract boolean areContentsTheSame(Value oldItem, Value newItem)

Called to decide whether two items have the same data.

abstract boolean areItemsTheSame(Value oldItem, Value newItem)

Called to decide whether two objects represent the same item.

Object getChangePayload(Value oldItem, Value newItem)

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

Inherited methods

From class java.lang.Object

Public constructors

DiffCallback

added in version 27.1.0
DiffCallback ()

Public methods

areContentsTheSame

added in version 27.1.0
boolean areContentsTheSame (Value oldItem, 
                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
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 version 27.1.0
boolean areItemsTheSame (Value oldItem, 
                Value newItem)

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.

getChangePayload

added in version 27.1.0
Object getChangePayload (Value oldItem, 
                Value newItem)

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

Parameters
oldItem Value

newItem Value

Returns
Object