ConcatAdapter.Config.StableIdMode
public
static
final
enum
ConcatAdapter.Config.StableIdMode
extends Enum<ConcatAdapter.Config.StableIdMode>
java.lang.Object | ||
↳ | java.lang.Enum<androidx.recyclerview.widget.ConcatAdapter.Config.StableIdMode> | |
↳ | androidx.recyclerview.widget.ConcatAdapter.Config.StableIdMode |
Defines how ConcatAdapter
handle stable ids (RecyclerView.Adapter.hasStableIds()
).
Summary
Enum values | |
---|---|
ConcatAdapter.Config.StableIdMode |
ISOLATED_STABLE_IDS
In this mode, |
ConcatAdapter.Config.StableIdMode |
NO_STABLE_IDS
In this mode, |
ConcatAdapter.Config.StableIdMode |
SHARED_STABLE_IDS
In this mode, |
Public methods | |
---|---|
static
ConcatAdapter.Config.StableIdMode
|
valueOf(String name)
|
static
final
StableIdMode[]
|
values()
|
Inherited methods | |
---|---|
Enum values
ISOLATED_STABLE_IDS
public static final ConcatAdapter.Config.StableIdMode ISOLATED_STABLE_IDS
In this mode, ConcatAdapter
will return true
from
RecyclerView.Adapter.hasStableIds()
and will require all added
RecyclerView.Adapter
s to have stable ids. As two different adapters may return
same stable ids because they are unaware of each-other, ConcatAdapter
will
isolate each RecyclerView.Adapter
's id pool from each other such that it will overwrite
the reported stable id before reporting back to the RecyclerView
. In this
mode, the value returned from RecyclerView.ViewHolder.getItemId()
might differ from the
value returned from RecyclerView.Adapter.getItemId(int)
.
Adding an adapter without stable ids will result in an
IllegalArgumentException
.
NO_STABLE_IDS
public static final ConcatAdapter.Config.StableIdMode NO_STABLE_IDS
In this mode, ConcatAdapter
ignores the stable
ids reported by sub adapters. This is the default mode.
Adding an RecyclerView.Adapter
with stable ids will result in a warning as it will be
ignored.
SHARED_STABLE_IDS
public static final ConcatAdapter.Config.StableIdMode SHARED_STABLE_IDS
In this mode, ConcatAdapter
will return true
from
RecyclerView.Adapter.hasStableIds()
and will require all added
RecyclerView.Adapter
s to have stable ids. Unlike ISOLATED_STABLE_IDS
,
ConcatAdapter
will not override the returned item ids. In this mode,
child RecyclerView.Adapter
s must be aware of each-other and never return the same id
unless and item is moved between RecyclerView.Adapter
s.
Adding an adapter without stable ids will result in an
IllegalArgumentException
.
Public methods
valueOf
public static ConcatAdapter.Config.StableIdMode valueOf (String name)
Parameters | |
---|---|
name |
String |
Returns | |
---|---|
ConcatAdapter.Config.StableIdMode |
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.
Last updated 2020-11-05 UTC.