TtListRecyclerView
A reusable RecyclerView control that displays view items as a list.
The content is populated by the derived ListItemViewModels and can be set by providing either of:
A List of ListItemViewModel.
A PagingData of ListItemViewModel. See TtListRecyclerView.setListItems.
This control provides an optional sticky header. The sticky header is a header view which is always shown on the top of the RecyclerView and doesn't disappear. It shows the content of the appropriate header while scrolling.
Dividers, thin lines between list items, can also be enabled by setting ttDivider to true
. Note: When there is padding inside a RecyclerView, set ttDividerInsetStart and ttDividerInsetEnd to their corresponding values to have the best visual representation.
All theme attributes used by this control are declared in com.tomtom.tools.android.core.theme
. To use this control, it is mandatory to define these attribute values.
Parameters
The display context.
The attribute set provided in the layout XML file.
The default style attribute set.
Constructors
Properties
The LifecycleOwner of the RecyclerView. Since the content of a RecyclerView can be updated through LiveData, it is required to have a LifecycleOwner in order to observe the content data changes.
Shows the sticky header when set to true
. The default value is false
. The sticky header is a header view which is always shown on the top of the RecyclerView and doesn't disappear. It shows the content of the appropriate header while scrolling.
The creator of the views of type ListItemViewModel.ListItemType.CONTENT. Can be used to customize the appearance of the views.
The color of the divider. A divider is a thin line drawn between list items while ttDivider is true
.
The end inset of the divider. A divider is a thin line drawn between list items while ttDivider is true
.
The start inset of the divider. A divider is a thin line drawn between list items while ttDivider is true
.
The thickness of the divider. A divider is a thin line drawn between list items while ttDivider is true
.
Draws the divider below the last item in the list or not. A divider is a thin line drawn between list items while ttDivider is true
.
The creator of the views of type ListItemViewModel.ListItemType.HEADER. Can be used to customize the appearance of the views.
Inherited functions
Provides ListItemViewModels to populate items in TtListRecyclerView. When all ViewModels are known in advance and won't change dynamically, put them in a List and set it using this method. If ViewModels are loaded dynamically, e.g. from local storage or over network, use the PagingData version of this method instead.
Used to provide the view with paging information to populate the TtListRecyclerView. This paging information consists of ListItemViewModels representing the actual items in TtListRecyclerViews.