SwipeableListItem


public interface SwipeableListItem

Known direct subclasses
ListItemCardView

A MaterialCardView that is styled as a list item and can be swiped in a ListItemLayout with a sibling RevealableListItem.


Interface for the part of a ListItem that is able to be swiped.

Summary

Constants

default static final int

The state at which the associated RevealableListItem is closed and nothing is revealed.

default static final int

The state at which the SwipeableListItem is being dragged.

default static final int

The state at which the associated RevealableListItem is revealed to its intrinsic width.

default static final int

The state at which the SwipeableListItem is settling to the nearest settling point.

default static final int

The state at which the SwipeableListItem is fully swiped, meaning the primary action has been committed.

Public methods

abstract int

Returns the overshoot, in pixels, that the SwipeableListItem is able to be swiped past the STATE_OPEN or STATE_SWIPE_PRIMARY_ACTION states by, before settling.

abstract boolean

Whether or not to allow the SwipeableListItem to be swiped.

abstract void
onSwipe(int swipeOffset)

Called when the position of the SwipeableListItem changes.

abstract void
<T extends View & RevealableListItem> onSwipeStateChanged(
    int swipeState,
    T revealableListItem,
    int revealGravity
)

Callback for when the swipe state of the SwipeableListItem changes.

abstract void
setSwipeEnabled(boolean swipeEnabled)

Sets whether or not to allow the SwipeableListItem to be swiped.

Constants

STATE_CLOSED

default static final int STATE_CLOSED = 3

The state at which the associated RevealableListItem is closed and nothing is revealed.

STATE_DRAGGING

default static final int STATE_DRAGGING = 1

The state at which the SwipeableListItem is being dragged.

STATE_OPEN

default static final int STATE_OPEN = 4

The state at which the associated RevealableListItem is revealed to its intrinsic width.

STATE_SETTLING

default static final int STATE_SETTLING = 2

The state at which the SwipeableListItem is settling to the nearest settling point.

STATE_SWIPE_PRIMARY_ACTION

default static final int STATE_SWIPE_PRIMARY_ACTION = 5

The state at which the SwipeableListItem is fully swiped, meaning the primary action has been committed.

Public methods

getSwipeMaxOvershoot

abstract int getSwipeMaxOvershoot()

Returns the overshoot, in pixels, that the SwipeableListItem is able to be swiped past the STATE_OPEN or STATE_SWIPE_PRIMARY_ACTION states by, before settling.

isSwipeEnabled

abstract boolean isSwipeEnabled()

Whether or not to allow the SwipeableListItem to be swiped.

onSwipe

abstract void onSwipe(int swipeOffset)

Called when the position of the SwipeableListItem changes.

onSwipeStateChanged

abstract void <T extends View & RevealableListItem> onSwipeStateChanged(
    int swipeState,
    T revealableListItem,
    int revealGravity
)

Callback for when the swipe state of the SwipeableListItem changes.

Parameters
int swipeState

The new SwipeState of the SwipeableListItem.

T revealableListItem

The associated RevealableListItem that is being revealed when swiped. If the new state is STATE_CLOSED, this will be the last active RevealableListItem.

int revealGravity

The RevealGravity of the revealableListItem.

setSwipeEnabled

abstract void setSwipeEnabled(boolean swipeEnabled)

Sets whether or not to allow the SwipeableListItem to be swiped.