ItemKeyProvider
public
abstract
class
ItemKeyProvider
extends Object
| java.lang.Object | |
| ↳ | androidx.recyclerview.selection.ItemKeyProvider<K> |
Provides selection library access to stable selection keys identifying items
presented by a RecyclerView instance.
Summary
Nested classes | |
|---|---|
@interface |
ItemKeyProvider.Scope
|
Constants | |
|---|---|
int |
SCOPE_CACHED
Provides access to cached data based for items that were recently bound in the view. |
int |
SCOPE_MAPPED
Provides access to all data, regardless of whether it is bound to a view or not. |
Protected constructors | |
|---|---|
ItemKeyProvider(int scope)
Creates a new provider with the given scope. |
|
Public methods | |
|---|---|
abstract
K
|
getKey(int position)
|
abstract
int
|
getPosition(K key)
|
Inherited methods | |
|---|---|
Constants
SCOPE_CACHED
public static final int SCOPE_CACHED
Provides access to cached data based for items that were recently bound in the view. Employing this provider will result in a reduced feature-set, as some features like SHIFT+click range selection and band selection are dependent on mapped access.
Constant Value: 1 (0x00000001)
SCOPE_MAPPED
public static final int SCOPE_MAPPED
Provides access to all data, regardless of whether it is bound to a view or not. Key providers with this access type enjoy support for enhanced features like: SHIFT+click range selection, and band selection.
Constant Value: 0 (0x00000000)
Protected constructors
ItemKeyProvider
protected ItemKeyProvider (int scope)
Creates a new provider with the given scope.
| Parameters | |
|---|---|
scope |
int: Scope can't be changed at runtime.
|
Public methods
getKey
public abstract K getKey (int position)
| Parameters | |
|---|---|
position |
int |
| Returns | |
|---|---|
K |
The selection key at the given adapter position, or null. |
getPosition
public abstract int getPosition (K key)
| Parameters | |
|---|---|
key |
K |
| Returns | |
|---|---|
int |
the position corresponding to the selection key, or RecyclerView.NO_POSITION. |
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.