Package 

Interface ListPreloader.PreloadModelProvider

    • Method Summary

      Modifier and Type Method Description
      abstract List<U> getPreloadItems(int position) Returns a List of models that need to be loaded for the list to display adapter itemsin positions between {@code start} and {@code end}.
      abstract RequestBuilder<out Object> getPreloadRequestBuilder(@NonNull() U item) Returns a RequestBuilder for a given item on which } has been called or {@code null} if no valid load can bestarted.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getPreloadItems

        @NonNull() abstract List<U> getPreloadItems(int position)

        Returns a List of models that need to be loaded for the list to display adapter itemsin positions between {@code start} and {@code end}.

        A list of any size can be returned so there can be multiple models per adapter position.

        Every model returned by this method is expected to produce a valid RequestBuilder in getPreloadRequestBuilder. If that's not possible for any set of models,avoid including them in the List returned by this method.

        Although it's acceptable for the returned List to contain {@code null} models,it's best to filter them from the list instead of adding {@code null} to avoid unnecessarylogic and expanding the size of the List

        Parameters:
        position - The adapter position.
      • getPreloadRequestBuilder

        @Nullable() abstract RequestBuilder<out Object> getPreloadRequestBuilder(@NonNull() U item)

        Returns a RequestBuilder for a given item on which } has been called or {@code null} if no valid load can bestarted.

        For the preloader to be effective, the RequestBuilder returned here must useexactly the same size and set of options as the RequestBuilder used when the ``View``is bound. You may need to specify a size in both places to ensure that the width and heightmatch exactly. If so, you can use to do so.

        The target and context will be provided by the preloader.

        If load is not called by this method, the preloader willtrigger a RuntimeException. If you don't want to load a particular item or position,filter it from the list returned by getPreloadItems.

        Parameters:
        item - The model to load.