AsyncListUtil.ViewCallback
public abstract class AsyncListUtil.ViewCallback
The callback that links AsyncListUtil with the list view.
All methods are called on the main thread.
Summary
Constants |
|
|---|---|
static final int |
HINT_SCROLL_ASC = 2Scrolling in ascending order (from lower to higher positions in the order of the backing storage). |
static final int |
HINT_SCROLL_DESC = 1Scrolling in descending order (from higher to lower positions in the order of the backing storage). |
static final int |
HINT_SCROLL_NONE = 0No scroll direction hint available. |
Public constructors |
|---|
Public methods |
|
|---|---|
void |
@UiThreadCompute a wider range of items that will be loaded for smoother scrolling. |
abstract void |
@UiThreadCompute the range of visible item positions. |
abstract void |
Called when the entire data set has changed. |
abstract void |
@UiThreadCalled when an item at the given position is loaded. |
Constants
HINT_SCROLL_ASC
public static final int HINT_SCROLL_ASC = 2
Scrolling in ascending order (from lower to higher positions in the order of the backing storage).
HINT_SCROLL_DESC
public static final int HINT_SCROLL_DESC = 1
Scrolling in descending order (from higher to lower positions in the order of the backing storage).
HINT_SCROLL_NONE
public static final int HINT_SCROLL_NONE = 0
No scroll direction hint available.
Public constructors
Public methods
extendRangeInto
@UiThread
public void extendRangeInto(
@NonNull int[] range,
@NonNull int[] outRange,
int scrollHint
)
Compute a wider range of items that will be loaded for smoother scrolling.
If there is no scroll hint, the default implementation extends the visible range by half its length in both directions. If there is a scroll hint, the range is extended by its full length in the scroll direction, and by half in the other direction.
For example, if range is {100, 200} and scrollHint is HINT_SCROLL_ASC, then outRange will be {50, 300}.
However, if scrollHint is HINT_SCROLL_NONE, then outRange will be {50, 250}
getItemRangeInto
@UiThread
public abstract void getItemRangeInto(@NonNull int[] outRange)
Compute the range of visible item positions.
outRange[0] is the position of the first visible item (in the order of the backing storage).
outRange[1] is the position of the last visible item (in the order of the backing storage).
Negative positions and positions greater or equal to getItemCount are invalid. If the returned range contains invalid positions it is ignored (no item will be loaded).
| Parameters | |
|---|---|
@NonNull int[] outRange |
The visible item range. |
onDataRefresh
@UiThread
public abstract void onDataRefresh()
Called when the entire data set has changed.
onItemLoaded
@UiThread
public abstract void onItemLoaded(int position)
Called when an item at the given position is loaded.
| Parameters | |
|---|---|
int position |
Item position. |