T
- The type of the model being displayed in the list.public class ListPreloader<T> extends Object implements AbsListView.OnScrollListener
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
AbsListView.setOnScrollListener(android.widget.AbsListView.OnScrollListener)
, or have its
corresponding methods called from another AbsListView.OnScrollListener
to
function.
限定符和类型 | 类和说明 |
---|---|
static interface |
ListPreloader.PreloadModelProvider<U>
An implementation of PreloadModelProvider should provide all the models that should be
preloaded.
|
static interface |
ListPreloader.PreloadSizeProvider<T>
An implementation of PreloadSizeProvider should provide the size of the view in the list where
the resources will be displayed.
|
SCROLL_STATE_FLING, SCROLL_STATE_IDLE, SCROLL_STATE_TOUCH_SCROLL
构造器和说明 |
---|
ListPreloader(RequestManager requestManager,
ListPreloader.PreloadModelProvider<T> preloadModelProvider,
ListPreloader.PreloadSizeProvider<T> preloadDimensionProvider,
int maxPreload)
Constructor for
ListPreloader 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. |
限定符和类型 | 方法和说明 |
---|---|
void |
onScroll(AbsListView absListView,
int firstVisible,
int visibleCount,
int totalCount) |
void |
onScrollStateChanged(AbsListView absListView,
int scrollState) |
public ListPreloader(@NonNull RequestManager requestManager, @NonNull ListPreloader.PreloadModelProvider<T> preloadModelProvider, @NonNull ListPreloader.PreloadSizeProvider<T> preloadDimensionProvider, int maxPreload)
ListPreloader
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.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.public void onScrollStateChanged(AbsListView absListView, int scrollState)
public void onScroll(AbsListView absListView, int firstVisible, int visibleCount, int totalCount)
onScroll
在接口中 AbsListView.OnScrollListener