RecyclerViewPreloader
Loads a few resources ahead in the direction of scrolling in any RecyclerView so that images are in the memory cache just before the corresponding view in created in the list. Gives the appearance of an infinitely large image cache, depending on scrolling speed, cpu speed, and cache size.
Must be added as a listener to the RecyclerView using addOnScrollListener, or have its corresponding methods called from another androidx.recyclerview.widget.RecyclerView.OnScrollListener to function.
This class only works with androidx.recyclerview.widget.LinearLayoutManager and subclasses of androidx.recyclerview.widget.LinearLayoutManager.
Parameters
<T>
The type of the model being displayed in the RecyclerView.
Constructors
Link copied to clipboard
open fun RecyclerViewPreloader( activity: Activity, preloadModelProvider: PreloadModelProvider<T>, preloadDimensionProvider: PreloadSizeProvider<T>, maxPreload: Int)
Content copied to clipboard
Helper constructor that accepts an Activity.
Link copied to clipboard
open fun RecyclerViewPreloader( fragmentActivity: FragmentActivity, preloadModelProvider: PreloadModelProvider<T>, preloadDimensionProvider: PreloadSizeProvider<T>, maxPreload: Int)
Content copied to clipboard
Helper constructor that accepts an FragmentActivity.
Link copied to clipboard
open fun RecyclerViewPreloader( fragment: Fragment, preloadModelProvider: PreloadModelProvider<T>, preloadDimensionProvider: PreloadSizeProvider<T>, maxPreload: Int)
Content copied to clipboard
Helper constructor that accepts an Fragment.
Link copied to clipboard
Content copied to clipboard
Helper constructor that accepts an android.app.
Link copied to clipboard
open fun RecyclerViewPreloader( requestManager: RequestManager, preloadModelProvider: PreloadModelProvider<T>, preloadDimensionProvider: PreloadSizeProvider<T>, maxPreload: Int)
Content copied to clipboard
Constructor that accepts interfaces for providing the dimensions of images to preload, the list of models to preload for a given position, and the request to use to load images.