-
- All Implemented Interfaces:
-
android.widget.AbsListView.OnScrollListener
public class ListPreloader<T> implements AbsListView.OnScrollListener
Loads a few resources ahead in the direction of scrolling in any AbsListView 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 put using , or have its corresponding methods called from another AbsListView.OnScrollListener to function.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceListPreloader.PreloadModelProviderAn implementation of PreloadModelProvider should provide all the models that should bepreloaded.
public interfaceListPreloader.PreloadSizeProviderAn implementation of PreloadSizeProvider should provide the size of the view in the list wherethe resources will be displayed.
-
Constructor Summary
Constructors Constructor Description ListPreloader(RequestManager requestManager, ListPreloader.PreloadModelProvider<T> preloadModelProvider, ListPreloader.PreloadSizeProvider<T> preloadDimensionProvider, int maxPreload)Constructor for ListPreloader that accepts interfaces for providingthe dimensions of images to preload, the list of models to preload for a given position, andthe request to use to load images.
-
Method Summary
Modifier and Type Method Description voidonScrollStateChanged(AbsListView absListView, int scrollState)voidonScroll(AbsListView absListView, int firstVisible, int visibleCount, int totalCount)-
-
Constructor Detail
-
ListPreloader
ListPreloader(RequestManager requestManager, ListPreloader.PreloadModelProvider<T> preloadModelProvider, ListPreloader.PreloadSizeProvider<T> preloadDimensionProvider, int maxPreload)
Constructor for ListPreloader that accepts interfaces for providingthe dimensions of images to preload, the list of models to preload for a given position, andthe 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
void onScrollStateChanged(AbsListView absListView, int scrollState)
-
onScroll
void onScroll(AbsListView absListView, int firstVisible, int visibleCount, int totalCount)
-
-
-
-