SelectionObserver

abstract class SelectionObserver<K : Any!>
kotlin.Any
   ↳ androidx.recyclerview.selection.SelectionTracker.SelectionObserver

Observer class providing access to information about Selection state changes.

Summary

Public constructors

Public methods
open Unit

Called when the underlying data set has changed.

open Unit

Called immediately after selection is restored.

open Unit
onItemStateChanged(key: K, selected: Boolean)

Called when the state of an item has been changed.

open Unit

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

Public constructors

<init>

SelectionObserver()

Public methods

onSelectionRefresh

open fun onSelectionRefresh(): Unit

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

open fun onSelectionRestored(): Unit

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

onItemStateChanged

open fun onItemStateChanged(key: K, selected: Boolean): Unit

Called when the state of an item has been changed.

onSelectionChanged

open fun onSelectionChanged(): Unit

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