Join us on the livestream at Android Dev Summit on 7-8 November 2018, starting at 10AM PDT!

SelectionTracker.SelectionObserver

public static abstract class SelectionTracker.SelectionObserver
extends Object

java.lang.Object
   ↳ androidx.recyclerview.selection.SelectionTracker.SelectionObserver<K>


Observer class providing access to information about Selection state changes.

Summary

Public constructors

SelectionTracker.SelectionObserver()

Public methods

void onItemStateChanged(K key, boolean selected)

Called when the state of an item has been changed.

void onSelectionChanged()

Called immediately after completion of any set of changes, excluding those resulting in calls to onSelectionRefresh() and onSelectionRestored().

void onSelectionRefresh()

Called when the underlying data set has changed.

void onSelectionRestored()

Called immediately after selection is restored.

Inherited methods

Public constructors

SelectionTracker.SelectionObserver

public SelectionTracker.SelectionObserver ()

Public methods

onItemStateChanged

public void onItemStateChanged (K key, 
                boolean selected)

Called when the state of an item has been changed.

Parameters
key K

selected boolean

onSelectionChanged

public void onSelectionChanged ()

Called immediately after completion of any set of changes, excluding those resulting in calls to onSelectionRefresh() and onSelectionRestored().

onSelectionRefresh

public void onSelectionRefresh ()

Called when the underlying data set has changed. After this method is called SelectionTracker will traverse the existing selection, calling onItemStateChanged(K, boolean) for each selected item, and deselecting any items that cannot be selected given the updated data-set (and after consulting SelectionPredicate).

onSelectionRestored

public void onSelectionRestored ()

Called immediately after selection is restored. onItemStateChanged(K, boolean) will *not* be called for individual items in the selection.