public class

RecyclerViewSwipeManager

extends Object
implements SwipeableItemConstants
java.lang.Object
   ↳ com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager

Class Overview

Provides item swipe operation for android.support.v7.widget.RecyclerView

Summary

Nested Classes
interface RecyclerViewSwipeManager.OnItemSwipeEventListener Used for listening item swipe events  
[Expand]
Inherited Constants
From interface com.h6ah4i.android.widget.advrecyclerview.swipeable.SwipeableItemConstants
Public Constructors
RecyclerViewSwipeManager()
Constructor.
Public Methods
void attachRecyclerView(RecyclerView rv)

Attaches android.support.v7.widget.RecyclerView instance.

void cancelSwipe()
Adapter createWrappedAdapter(Adapter adapter)
Create wrapped adapter.
long getMoveToOutsideWindowAnimationDuration()
Gets the duration of the "move to outside of the window" animation
long getMoveToSpecifiedPositionAnimationDuration()
Gets the duration of the "move to specified position" animation
RecyclerViewSwipeManager.OnItemSwipeEventListener getOnItemSwipeEventListener()
Gets OnItemSwipeEventListener listener
long getReturnToDefaultPositionAnimationDuration()
Gets the duration of the "return to default position" animation
int getSwipeThresholdDistance()
Gets swipe threshold distance.
boolean isReleased()
Indicates this manager instance has released or not.
boolean isSwiping()
Indicates whether currently performing item swiping.
boolean performFakeSwipe(RecyclerView.ViewHolder holder, int result)
Perform fake swiping.
void release()

Detach the android.support.v7.widget.RecyclerView instance and release internal field references.

void setLongPressTimeout(int longPressTimeout)
Sets the time required to consider press as long press.
void setMoveToOutsideWindowAnimationDuration(long duration)
Sets the duration of the "move to outside of the window" animation
void setMoveToSpecifiedPositionAnimationDuration(long duration)
Sets the duration of the "move to specified position" animation
void setOnItemSwipeEventListener(RecyclerViewSwipeManager.OnItemSwipeEventListener listener)
Sets OnItemSwipeEventListener listener
void setReturnToDefaultPositionAnimationDuration(long duration)
Sets the duration of the "return to default position" animation
void setSwipeThresholdDistance(int distanceInPixels)
Sets swipe threshold distance.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public RecyclerViewSwipeManager ()

Constructor.

Public Methods

public void attachRecyclerView (RecyclerView rv)

Attaches android.support.v7.widget.RecyclerView instance.

Before calling this method, the target android.support.v7.widget.RecyclerView must set the wrapped adapter instance which is returned by the createWrappedAdapter(android.support.v7.widget.RecyclerView.Adapter) method.

Parameters
rv The android.support.v7.widget.RecyclerView instance

public void cancelSwipe ()

public Adapter createWrappedAdapter (Adapter adapter)

Create wrapped adapter.

Parameters
adapter The target adapter.
Returns

public long getMoveToOutsideWindowAnimationDuration ()

Gets the duration of the "move to outside of the window" animation

Returns
  • Duration of the "move to outside of the window" animation in milliseconds

public long getMoveToSpecifiedPositionAnimationDuration ()

Gets the duration of the "move to specified position" animation

Returns
  • Duration of the "move to specified position" animation in milliseconds

public RecyclerViewSwipeManager.OnItemSwipeEventListener getOnItemSwipeEventListener ()

Gets OnItemSwipeEventListener listener

Returns
  • The listener object

public long getReturnToDefaultPositionAnimationDuration ()

Gets the duration of the "return to default position" animation

Returns
  • Duration of the "return to default position" animation in milliseconds

public int getSwipeThresholdDistance ()

Gets swipe threshold distance.

Returns
  • Threshold distance in pixels.

public boolean isReleased ()

Indicates this manager instance has released or not.

Returns
  • True if this manager instance has released

public boolean isSwiping ()

Indicates whether currently performing item swiping.

Returns
  • True if currently performing item swiping

public boolean performFakeSwipe (RecyclerView.ViewHolder holder, int result)

Perform fake swiping.

Parameters
holder Target ViewHolder.
result swipe result code
Returns
  • true for successful, otherwise false.

public void release ()

Detach the android.support.v7.widget.RecyclerView instance and release internal field references.

This method should be called in order to avoid memory leaks.

public void setLongPressTimeout (int longPressTimeout)

Sets the time required to consider press as long press. (default: 500ms)

Parameters
longPressTimeout Integer in milli seconds.

public void setMoveToOutsideWindowAnimationDuration (long duration)

Sets the duration of the "move to outside of the window" animation

Parameters
duration Duration of the "move to outside of the window" animation in milliseconds

public void setMoveToSpecifiedPositionAnimationDuration (long duration)

Sets the duration of the "move to specified position" animation

Parameters
duration Duration of the "move to specified position" animation in milliseconds

public void setOnItemSwipeEventListener (RecyclerViewSwipeManager.OnItemSwipeEventListener listener)

Sets OnItemSwipeEventListener listener

Parameters
listener The listener object

public void setReturnToDefaultPositionAnimationDuration (long duration)

Sets the duration of the "return to default position" animation

Parameters
duration Duration of the "return to default position" animation in milliseconds

public void setSwipeThresholdDistance (int distanceInPixels)

Sets swipe threshold distance.

Parameters
distanceInPixels Integer specifies threshold distance in pixels.