Package com.bumptech.glide
Class ListPreloader<T>
- java.lang.Object
-
- com.bumptech.glide.ListPreloader<T>
-
- Type Parameters:
T- The type of the model being displayed in the list.
- All Implemented Interfaces:
android.widget.AbsListView.OnScrollListener
public class ListPreloader<T> extends java.lang.Object implements android.widget.AbsListView.OnScrollListenerLoads a few resources ahead in the direction of scrolling in anyAbsListViewso 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 put using
AbsListView.setOnScrollListener(android.widget.AbsListView.OnScrollListener), or have its corresponding methods called from anotherAbsListView.OnScrollListenerto function.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceListPreloader.PreloadModelProvider<U>An implementation of PreloadModelProvider should provide all the models that should be preloaded.static interfaceListPreloader.PreloadSizeProvider<T>An implementation of PreloadSizeProvider should provide the size of the view in the list where the resources will be displayed.
-
Constructor Summary
Constructors Constructor Description ListPreloader(RequestManager requestManager, ListPreloader.PreloadModelProvider<T> preloadModelProvider, ListPreloader.PreloadSizeProvider<T> preloadDimensionProvider, int maxPreload)Constructor forListPreloaderthat 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonScroll(android.widget.AbsListView absListView, int firstVisible, int visibleCount, int totalCount)voidonScrollStateChanged(android.widget.AbsListView absListView, int scrollState)
-
-
-
Constructor Detail
-
ListPreloader
public ListPreloader(@NonNull RequestManager requestManager, @NonNull ListPreloader.PreloadModelProvider<T> preloadModelProvider, @NonNull ListPreloader.PreloadSizeProvider<T> preloadDimensionProvider, int maxPreload)Constructor forListPreloaderthat 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.- Parameters:
preloadModelProvider- Provides models to load and requests capable of loading them.preloadDimensionProvider- Provides the dimensions of images to load.maxPreload- Maximum number of items to preload.
-
-
Method Detail
-
onScrollStateChanged
public void onScrollStateChanged(android.widget.AbsListView absListView, int scrollState)- Specified by:
onScrollStateChangedin interfaceandroid.widget.AbsListView.OnScrollListener
-
onScroll
public void onScroll(android.widget.AbsListView absListView, int firstVisible, int visibleCount, int totalCount)- Specified by:
onScrollin interfaceandroid.widget.AbsListView.OnScrollListener
-
-