public final class RepositoryPresenters
extends java.lang.Object
RepositoryPresenter to present the content of a
Repository.| Modifier and Type | Method and Description |
|---|---|
static <T> RepositoryPresenterCompilerStates.RPLayout<T,RepositoryPresenterCompilerStates.RPMain<T>> |
repositoryPresenterOf(java.lang.Class<T> type)
Starts the creation of a compiled
RepositoryPresenter. |
@NonNull public static <T> RepositoryPresenterCompilerStates.RPLayout<T,RepositoryPresenterCompilerStates.RPMain<T>> repositoryPresenterOf(@Nullable java.lang.Class<T> type)
RepositoryPresenter. A compiled presenter work with
item objects: firstly, the repository value is converted to a list of item objects, the list
size determining the item count; then the layout resources, item IDs, binding, and change
detection are all based on the individual item objects. Client code supplies the logic for each
aspect of the presenter, such as:
.layoutForItem(Function<T, Integer>) selects the layout
resource ID for each item object;
.stableIdForItem(Function<T, Long>) provides a stable ID
per item object;
.bindWidth(Binder<T, View>) renders the item data onto the view;
.forCollection(Function<V, List<T>>) specifies the
method to convert the repository value (of type V) to an item list (shortcuts are
provided for repository values of type T, List<T>, Result<T> or
Result<List<T>> that can be converted in typical ways).
type - The type of the item objects.