-
public abstract class AsyncListUtil.ViewCallback
The callback that links AsyncListUtil with the list view.
All methods are called on the main thread.
-
-
Field Summary
Fields Modifier and Type Field Description public final static int
HINT_SCROLL_NONE
public final static int
HINT_SCROLL_DESC
public final static int
HINT_SCROLL_ASC
-
Method Summary
Modifier and Type Method Description abstract void
getItemRangeInto(@NonNull() Array<int> outRange)
Compute the range of visible item positions. void
extendRangeInto(@NonNull() Array<int> range, @NonNull() Array<int> outRange, int scrollHint)
Compute a wider range of items that will be loaded for smoother scrolling. abstract void
onDataRefresh()
Called when the entire data set has changed. abstract void
onItemLoaded(int position)
Called when an item at the given position is loaded. -
-
Method Detail
-
getItemRangeInto
@UiThread() abstract void getItemRangeInto(@NonNull() Array<int> outRange)
Compute the range of visible item positions.
outRange[0] is the position of the first visible item (in the order of the backingstorage).
outRange[1] is the position of the last visible item (in the order of the backingstorage).
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:
outRange
- The visible item range.
-
extendRangeInto
@UiThread() void extendRangeInto(@NonNull() Array<int> range, @NonNull() Array<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 halfits length in both directions. If there is a scroll hint, the range is extended byits full length in the scroll direction, and by half in the other direction.
For example, if
range
is{100, 200}
andscrollHint
is HINT_SCROLL_ASC, thenoutRange
will be{50, 300}
.However, if
scrollHint
is HINT_SCROLL_NONE, thenoutRange
will be{50, 250}
- Parameters:
range
- Visible item range.outRange
- Extended range.scrollHint
- The scroll direction hint.
-
onDataRefresh
@UiThread() abstract void onDataRefresh()
Called when the entire data set has changed.
-
onItemLoaded
@UiThread() abstract void onItemLoaded(int position)
Called when an item at the given position is loaded.
- Parameters:
position
- Item position.
-
-
-
-