public interface

SwipeableItemAdapter

com.h6ah4i.android.widget.advrecyclerview.swipeable.SwipeableItemAdapter<T extends androidx.recyclerview.widget.RecyclerView.ViewHolder>

Summary

Public Methods
abstract int onGetSwipeReactionType(T holder, int position, int x, int y)
Called when the user is attempt to swipe an item.
abstract void onSetSwipeBackground(T holder, int position, int type)
Called when sets background of the swiping item.
abstract SwipeResultAction onSwipeItem(T holder, int position, int result)
Called when an item is swiped.
abstract void onSwipeItemStarted(T holder, int position)
Called when started swiping an item.

Public Methods

public abstract int onGetSwipeReactionType (T holder, int position, int x, int y)

Called when the user is attempt to swipe an item.

Parameters
holder The ViewHolder which is associated to item user is attempt to start swiping.
position The position of the item within the adapter's data set.
x Touched X position. Relative from the itemView's top-left.
y Touched Y position. Relative from the itemView's top-left.

public abstract void onSetSwipeBackground (T holder, int position, int type)

Called when sets background of the swiping item.

Parameters
holder The ViewHolder which is associated to the swiping item.
position The position of the item within the adapter's data set.
type Background type. One of the DRAWABLE_SWIPE_NEUTRAL_BACKGROUND, DRAWABLE_SWIPE_LEFT_BACKGROUND, DRAWABLE_SWIPE_UP_BACKGROUND, DRAWABLE_SWIPE_RIGHT_BACKGROUND or DRAWABLE_SWIPE_DOWN_BACKGROUND.

public abstract SwipeResultAction onSwipeItem (T holder, int position, int result)

Called when an item is swiped. *Note that do not change the data set and do not call notifyDataXXX() methods inside of this method.*

Parameters
holder The ViewHolder which is associated to the swiped item.
position The position of the item within the adapter's data set.
result The result code of user's swipe operation. RESULT_CANCELED, RESULT_SWIPED_LEFT, RESULT_SWIPED_UP, RESULT_SWIPED_RIGHT or RESULT_SWIPED_DOWN
Returns

public abstract void onSwipeItemStarted (T holder, int position)

Called when started swiping an item. Call the notifyDataSetChanged() method in this callback to get the same behavior with v0.10.x or before.

Parameters
holder The ViewHolder that is associated the swiped item.
position The position of the item within the adapter's data set.