SortedListAdapterCallback

abstract class SortedListAdapterCallback<T2> : SortedList.Callback


A SortedList.Callback implementation that can bind a SortedList to a RecyclerView.Adapter.

Summary

Public constructors

Creates a SortedList.Callback that will forward data change events to the provided Adapter.

Public functions

Unit
onChanged(position: Int, count: Int)

Called by the SortedList when the item at the given position is updated.

Unit
onChanged(position: Int, count: Int, payload: Any!)
Unit
onInserted(position: Int, count: Int)

Called when count} number of items are inserted at the given position.

Unit
onMoved(fromPosition: Int, toPosition: Int)

Called when an item changes its position in the list.

Unit
onRemoved(position: Int, count: Int)

Called when count} number of items are removed from the given position.

Inherited functions

From java.util.Comparator
abstract Int
compare(p: T!, p1: T!)
java-static Comparator<T!>!
<T, U> comparing(
    keyExtractor: Function<Any!, U!>!,
    keyComparator: Comparator<Any!>!
)
java-static Comparator<T!>!
<T> comparingDouble(keyExtractor: ToDoubleFunction<Any!>!)
java-static Comparator<T!>!
<T> comparingInt(keyExtractor: ToIntFunction<Any!>!)
java-static Comparator<T!>!
<T> comparingLong(keyExtractor: ToLongFunction<Any!>!)
java-static Comparator<T!>!
java-static Comparator<T!>!
<T> nullsFirst(comparator: Comparator<Any!>!)
java-static Comparator<T!>!
<T> nullsLast(comparator: Comparator<Any!>!)
java-static Comparator<T!>!
Comparator<T!>!
Comparator<T!>!
Comparator<T!>!
Comparator<T!>!
Comparator<T!>!
From androidx.recyclerview.widget.ListUpdateCallback
abstract Unit
onChanged(position: Int, count: Int, payload: Any?)

Called when count number of items are updated at the given position.

From androidx.recyclerview.widget.SortedList.Callback
abstract Boolean
areContentsTheSame(oldItem: T2!, newItem: T2!)

Called by the SortedList when it wants to check whether two items have the same data or not.

abstract Boolean
areItemsTheSame(item1: T2!, item2: T2!)

Called by the SortedList to decide whether two objects represent the same Item or not.

abstract Int
compare(o1: T2!, o2: T2!)

Similar to compare, should compare two and return how they should be ordered.

Any?
getChangePayload(item1: T2!, item2: T2!)

When areItemsTheSame returns true for two items and areContentsTheSame returns false for them, Callback calls this method to get a payload about the change.

Public constructors

SortedListAdapterCallback

Added in 1.3.0
SortedListAdapterCallback(adapter: RecyclerView.Adapter<Any!>!)

Creates a SortedList.Callback that will forward data change events to the provided Adapter.

Parameters
adapter: RecyclerView.Adapter<Any!>!

The Adapter instance which should receive events from the SortedList.

Public functions

onChanged

Added in 1.4.0-alpha01
fun onChanged(position: Int, count: Int): Unit

Called by the SortedList when the item at the given position is updated.

onChanged

fun onChanged(position: Int, count: Int, payload: Any!): Unit

onInserted

Added in 1.4.0-alpha01
fun onInserted(position: Int, count: Int): Unit

Called when count} number of items are inserted at the given position.

onMoved

Added in 1.4.0-alpha01
fun onMoved(fromPosition: Int, toPosition: Int): Unit

Called when an item changes its position in the list.

onRemoved

Added in 1.4.0-alpha01
fun onRemoved(position: Int, count: Int): Unit

Called when count} number of items are removed from the given position.