StableIdKeyProvider
public
final
class
StableIdKeyProvider
extends ItemKeyProvider<Long>
An ItemKeyProvider
that provides stable ids by way of cached
RecyclerView.Adapter
stable ids. Items enter the cache as they are laid out by
RecyclerView, and are removed from the cache as they are recycled.
There are trade-offs with this implementation as it necessarily auto-boxes long
stable id values into Long
values for use as selection keys. The core Selection API
uses a parameterized key type to permit other keys (such as Strings or URIs).
Summary
Public constructors |
StableIdKeyProvider(RecyclerView recyclerView)
Creates a new key provider that uses cached long stable ids associated
with the RecyclerView items.
|
Inherited methods |
|
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Public constructors
public StableIdKeyProvider (RecyclerView recyclerView)
Creates a new key provider that uses cached long
stable ids associated
with the RecyclerView items.
Parameters |
recyclerView |
RecyclerView : the owner RecyclerView
|
Public methods
getKey
public Long getKey (int position)
Returns |
Long |
The selection key at the given adapter position, or null.
|
getPosition
public int getPosition (Long key)
Returns |
int |
the position corresponding to the selection key, or RecyclerView.NO_POSITION.
|