ConcatAdapter.Config


class ConcatAdapter.Config


The configuration object for a ConcatAdapter.

Summary

Nested types

The builder for Config class.

Defines how ConcatAdapter handle stable ids (hasStableIds).

Constants

const ConcatAdapter.Config

Default configuration for ConcatAdapter where isolateViewTypes is set to true and stableIdMode is set to NO_STABLE_IDS.

Public properties

Boolean

If false, ConcatAdapter assumes all assigned adapters share a global view type pool such that they use the same view types to refer to the same ViewHolders.

ConcatAdapter.Config.StableIdMode

Defines whether the ConcatAdapter should support stable ids or not (hasStableIds.

Constants

DEFAULT

Added in 1.2.0
const val DEFAULTConcatAdapter.Config

Default configuration for ConcatAdapter where isolateViewTypes is set to true and stableIdMode is set to NO_STABLE_IDS.

Public properties

isolateViewTypes

Added in 1.2.0
val isolateViewTypesBoolean

If false, ConcatAdapter assumes all assigned adapters share a global view type pool such that they use the same view types to refer to the same ViewHolders.

Setting this to false will allow nested adapters to share ViewHolders but it also means these adapters should not have conflicting view types (getItemViewType) such that two different adapters return the same view type for different ViewHolders. By default, it is set to true which means ConcatAdapter will isolate view types across adapters, preventing them from using the same ViewHolders.

stableIdMode

Added in 1.2.0
val stableIdModeConcatAdapter.Config.StableIdMode

Defines whether the ConcatAdapter should support stable ids or not (hasStableIds.

There are 3 possible options: NO_STABLE_IDS: In this mode, ConcatAdapter ignores the stable ids reported by sub adapters. This is the default mode. ISOLATED_STABLE_IDS: In this mode, ConcatAdapter will return true from hasStableIds and will require all added Adapters to have stable ids. As two different adapters may return same stable ids because they are unaware of each-other, ConcatAdapter will isolate each 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 getItemId might differ from the value returned from getItemId. SHARED_STABLE_IDS: In this mode, ConcatAdapter will return true from hasStableIds and will require all added Adapters to have stable ids. Unlike ISOLATED_STABLE_IDS, ConcatAdapter will not override the returned item ids. In this mode, child Adapters must be aware of each-other and never return the same id unless an item is moved between Adapters. Default value is NO_STABLE_IDS.