added in version 1.0.0
belongs to Maven artifact androidx.recyclerview:recyclerview-selection:1.0.0-beta01

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

added in version 1.0.0
public SelectionTracker.SelectionObserver ()

Public methods

onItemStateChanged

added in version 1.0.0
public void onItemStateChanged (K key, 
                boolean selected)

Called when the state of an item has been changed.

Parameters
key K

selected boolean

onSelectionChanged

added in version 1.0.0
public void onSelectionChanged ()

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

onSelectionRefresh

added in version 1.0.0
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

added in version 1.0.0
public void onSelectionRestored ()

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