ListViewAutoScrollHelper

Added in 1.1.0

public class ListViewAutoScrollHelper extends AutoScrollHelper


An implementation of AutoScrollHelper that knows how to scroll through a ListView.

Summary

Public constructors

Public methods

boolean

Override this method to return whether the target view can be scrolled horizontally in a certain direction.

boolean

Override this method to return whether the target view can be scrolled vertically in a certain direction.

void
scrollTargetBy(int deltaX, int deltaY)

Override this method to scroll the target view by the specified number of pixels.

Inherited Constants

From androidx.core.widget.AutoScrollHelper
static final int

Edge type that specifies an activation area starting at the view bounds and extending inward.

static final int

Edge type that specifies an activation area starting at the view bounds and extending inward.

static final int

Edge type that specifies an activation area starting at the view bounds and extending outward.

static final float
NO_MAX = 3.4028235E38f

Constant passed to setMaximumEdges, setMaximumVelocity, or setMinimumVelocity.

static final float
NO_MIN = 0.0f

Constant passed to setMaximumEdges, or setMaximumVelocity, or setMinimumVelocity.

static final float

Constant passed to setRelativeEdges or setRelativeVelocity.

Inherited methods

From androidx.core.widget.AutoScrollHelper
boolean
boolean

Indicates whether the scroll helper handles touch events exclusively during scrolling.

boolean
onTouch(View v, MotionEvent event)

Handles touch events by activating automatic scrolling, adjusting scroll velocity, or stopping.

@NonNull AutoScrollHelper
setActivationDelay(int delayMillis)

Sets the delay after entering an activation edge before activation of auto-scrolling.

@NonNull AutoScrollHelper
setEdgeType(int type)

Sets the activation edge type, one of:

AutoScrollHelper
setEnabled(boolean enabled)

Sets whether the scroll helper is enabled and should respond to touch events.

AutoScrollHelper
setExclusive(boolean exclusive)

Enables or disables exclusive handling of touch events during scrolling.

@NonNull AutoScrollHelper
setMaximumEdges(float horizontalMax, float verticalMax)

Sets the absolute maximum edge size.

@NonNull AutoScrollHelper
setMaximumVelocity(float horizontalMax, float verticalMax)

Sets the absolute maximum scrolling velocity.

@NonNull AutoScrollHelper
setMinimumVelocity(float horizontalMin, float verticalMin)

Sets the absolute minimum scrolling velocity.

@NonNull AutoScrollHelper
setRampDownDuration(int durationMillis)

Sets the amount of time after de-activation of auto-scrolling that is takes to slow to a stop.

@NonNull AutoScrollHelper
setRampUpDuration(int durationMillis)

Sets the amount of time after activation of auto-scrolling that is takes to reach target velocity for the current touch position.

@NonNull AutoScrollHelper
setRelativeEdges(float horizontal, float vertical)

Sets the activation edge size relative to the host view's dimensions.

@NonNull AutoScrollHelper
setRelativeVelocity(float horizontal, float vertical)

Sets the target scrolling velocity relative to the host view's dimensions.

From android.view.View.OnTouchListener
abstract boolean

Public constructors

ListViewAutoScrollHelper

Added in 1.1.0
public ListViewAutoScrollHelper(@NonNull ListView target)

Public methods

canTargetScrollHorizontally

public boolean canTargetScrollHorizontally(int direction)

Override this method to return whether the target view can be scrolled horizontally in a certain direction.

Parameters
int direction

Negative to check scrolling left, positive to check scrolling right.

Returns
boolean

true if the target view is able to horizontally scroll in the specified direction.

canTargetScrollVertically

public boolean canTargetScrollVertically(int direction)

Override this method to return whether the target view can be scrolled vertically in a certain direction.

Parameters
int direction

Negative to check scrolling up, positive to check scrolling down.

Returns
boolean

true if the target view is able to vertically scroll in the specified direction.

scrollTargetBy

public void scrollTargetBy(int deltaX, int deltaY)

Override this method to scroll the target view by the specified number of pixels.

Parameters
int deltaX

The number of pixels to scroll by horizontally.

int deltaY

The number of pixels to scroll by vertically.