|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bumptech.glide.ListPreloader<T>
T
- The type of the model being displayed in the list.public abstract class ListPreloader<T>
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 set using AbsListView.setOnScrollListener(android.widget.AbsListView.OnScrollListener)
, or have its
corresponding methods called from another AbsListView.OnScrollListener
to function.
Field Summary |
---|
Fields inherited from interface android.widget.AbsListView.OnScrollListener |
---|
SCROLL_STATE_FLING, SCROLL_STATE_IDLE, SCROLL_STATE_TOUCH_SCROLL |
Constructor Summary | |
---|---|
ListPreloader(int maxPreload)
Constructor for the preloader. |
Method Summary | |
---|---|
protected abstract int[] |
getDimensions(T item)
Returns the dimensions of the view in the list where the resources will be displayed. |
protected abstract List<T> |
getItems(int start,
int end)
Returns a list of all models that need to be loaded for the list to display adapter items start - end . |
protected abstract GenericRequestBuilder |
getRequestBuilder(T item)
Returns a glide request for a given item. |
void |
onScroll(AbsListView absListView,
int firstVisible,
int visibleCount,
int totalCount)
|
void |
onScrollStateChanged(AbsListView absListView,
int scrollState)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ListPreloader(int maxPreload)
maxPreload
- The maximum number of items in the list to load ahead (corresponds to adapter positions).Method Detail |
---|
public void onScrollStateChanged(AbsListView absListView, int scrollState)
onScrollStateChanged
in interface AbsListView.OnScrollListener
public void onScroll(AbsListView absListView, int firstVisible, int visibleCount, int totalCount)
onScroll
in interface AbsListView.OnScrollListener
protected abstract int[] getDimensions(T item)
Note - The dimensions returned here must precisely match those of the view in the list.
item
- A model
protected abstract List<T> getItems(int start, int end)
start - end
.
A list of any size can be returned so there can be multiple models per adapter position.
start
- The smallest adapter position. Will be >= 0 && < adapter.getCount() && <= end
end
- The largest adapter position. Will be >= 0 && < adapter.getCount && >= start
start
and end
.protected abstract GenericRequestBuilder getRequestBuilder(T item)
item
- The model to load.
BitmapRequestBuilder
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |