ViewProvider

constructor(lifecycleOwner: LifecycleOwner, @LayoutRes layoutId: Int)

Convenience constructor to create a view provider that provides the same layout ID for all items.

If the item view inflated for the parent has a viewModel data binding variable, and its type matches with T, the variable is set to the this item. It is not mandatory to have a viewModel data binding variable.

A ViewProvider created with this constructor sets supportsRebind to true, because the views are guaranteed to stay the same.


constructor(lifecycleOwner: LifecycleOwner, itemViewFactoryProvider: (T) -> ViewFactory<T>, supportsRebind: Boolean = false)

Parameters

T

the type of the items.