public abstract class

AsyncListUtil.ViewCallback

extends java.lang.Object

 java.lang.Object

↳androidx.recyclerview.widget.AsyncListUtil.ViewCallback

Overview

The callback that links AsyncListUtil with the list view.

All methods are called on the main thread.

Summary

Fields
public static final intHINT_SCROLL_ASC

Scrolling in ascending order (from lower to higher positions in the order of the backing storage).

public static final intHINT_SCROLL_DESC

Scrolling in descending order (from higher to lower positions in the order of the backing storage).

public static final intHINT_SCROLL_NONE

No scroll direction hint available.

Constructors
publicViewCallback()

Methods
public voidextendRangeInto(int[] range[], int[] outRange[], int scrollHint)

Compute a wider range of items that will be loaded for smoother scrolling.

public abstract voidgetItemRangeInto(int[] outRange[])

Compute the range of visible item positions.

public abstract voidonDataRefresh()

Called when the entire data set has changed.

public abstract voidonItemLoaded(int position)

Called when an item at the given position is loaded.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

public static final int HINT_SCROLL_NONE

No scroll direction hint available.

public static final int HINT_SCROLL_DESC

Scrolling in descending order (from higher to lower positions in the order of the backing storage).

public static final int HINT_SCROLL_ASC

Scrolling in ascending order (from lower to higher positions in the order of the backing storage).

Constructors

public ViewCallback()

Methods

public abstract void getItemRangeInto(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 AsyncListUtil.getItemCount() are invalid. If the returned range contains invalid positions it is ignored (no item will be loaded).

Parameters:

outRange: The visible item range.

public void extendRangeInto(int[] range[], 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 AsyncListUtil.ViewCallback.HINT_SCROLL_ASC, then outRange will be {50, 300}.

However, if scrollHint is AsyncListUtil.ViewCallback.HINT_SCROLL_NONE, then outRange will be {50, 250}

Parameters:

range: Visible item range.
outRange: Extended range.
scrollHint: The scroll direction hint.

public abstract void onDataRefresh()

Called when the entire data set has changed.

public abstract void onItemLoaded(int position)

Called when an item at the given position is loaded.

Parameters:

position: Item position.