public interface

SwipeableItemViewHolder

com.h6ah4i.android.widget.advrecyclerview.swipeable.SwipeableItemViewHolder
Known Indirect Subclasses

Class Overview

Interface which provides required information for swiping item.

Implement this interface on your sub-class of the androidx.recyclerview.widget.RecyclerView.ViewHolder.

Summary

Public Methods
abstract int getAfterSwipeReaction()
Gets the reaction type of after swiping item.
abstract float getMaxDownSwipeAmount()
Gets the maximum item down swipe amount.
abstract float getMaxLeftSwipeAmount()
Gets the maximum item left swipe amount.
abstract float getMaxRightSwipeAmount()
Gets the maximum item right swipe amount.
abstract float getMaxUpSwipeAmount()
Gets the maximum item up swipe amount.
abstract float getSwipeItemHorizontalSlideAmount()
Gets the amount of horizontal swipe.
abstract float getSwipeItemVerticalSlideAmount()
Gets the amount of vertical swipe.
abstract int getSwipeResult()
Gets the result code of swiping item.
abstract SwipeableItemState getSwipeState()
Gets the state object for swipeable item.
abstract int getSwipeStateFlags()
Gets the state flags value for swiping item.
abstract View getSwipeableContainerView()
Gets the container view for the swipeable area.
abstract boolean isProportionalSwipeAmountModeEnabled()
Gets whether the proportional swipe amount mode enabled.
abstract void onSlideAmountUpdated(float horizontalAmount, float verticalAmount, boolean isSwiping)
Called when sets background of the swiping item.
abstract void setAfterSwipeReaction(int reaction)
Sets the reaction type of after swiping item.
abstract void setMaxDownSwipeAmount(float amount)
Sets the maximum item down swipe amount.
abstract void setMaxLeftSwipeAmount(float amount)
Sets the maximum item left swipe amount.
abstract void setMaxRightSwipeAmount(float amount)
Sets the maximum item right swipe amount.
abstract void setMaxUpSwipeAmount(float amount)
Sets the maximum item up swipe amount.
abstract void setProportionalSwipeAmountModeEnabled(boolean enabled)
Sets proportional swipe amount mode enabled.
abstract void setSwipeItemHorizontalSlideAmount(float amount)
Sets the amount of horizontal swipe.
abstract void setSwipeItemVerticalSlideAmount(float amount)
Sets the amount of vertical swipe.
abstract void setSwipeResult(int result)
Sets the result code of swiping item.
abstract void setSwipeStateFlags(int flags)
Sets the state flags value for swiping item

Public Methods

public abstract int getAfterSwipeReaction ()

public abstract float getMaxDownSwipeAmount ()

Gets the maximum item down swipe amount.

Returns
  • Item swipe amount. If the item is configured as proportional amount mode, generally the range is [-1.0 .. 1.0], otherwise the value is specified in pixels.

public abstract float getMaxLeftSwipeAmount ()

Gets the maximum item left swipe amount.

Returns
  • Item swipe amount. If the item is configured as proportional amount mode, generally the range is [-1.0 .. 1.0], otherwise the value is specified in pixels.

public abstract float getMaxRightSwipeAmount ()

Gets the maximum item right swipe amount.

Returns
  • Item swipe amount. If the item is configured as proportional amount mode, generally the range is [-1.0 .. 1.0], otherwise the value is specified in pixels.

public abstract float getMaxUpSwipeAmount ()

Gets the maximum item up swipe amount.

Returns
  • Item swipe amount. If the item is configured as proportional amount mode, generally the range is [-1.0 .. 1.0], otherwise the value is specified in pixels.

public abstract float getSwipeItemHorizontalSlideAmount ()

Gets the amount of horizontal swipe.

Returns

public abstract float getSwipeItemVerticalSlideAmount ()

Gets the amount of vertical swipe.

Returns

public abstract int getSwipeResult ()

Gets the result code of swiping item.

public abstract SwipeableItemState getSwipeState ()

Gets the state object for swipeable item. This method can be used inside of the onBindViewHolder(RecyclerView.ViewHolder, int).

Returns

public abstract int getSwipeStateFlags ()

Gets the state flags value for swiping item. You can access these flags more human friendly way through getSwipeState().

Returns
See Also

public abstract View getSwipeableContainerView ()

Gets the container view for the swipeable area.

NOTE: Please DO NOT return itemView for this method. An IllegalArgumentException with massage "Tmp detached view should be removed from RecyclerView before it can be recycled" will be raised by RecyclerView.Recycler.

Returns
  • The container view instance.

public abstract boolean isProportionalSwipeAmountModeEnabled ()

Gets whether the proportional swipe amount mode enabled.

Returns
  • True if swipe amount is specified in proportional value, otherwise false.

public abstract void onSlideAmountUpdated (float horizontalAmount, float verticalAmount, boolean isSwiping)

Called when sets background of the swiping item.

Parameters
horizontalAmount Horizontal slide amount of the item view. (slide left: < 0, slide right: 0 >)
verticalAmount Vertical slide amount of the item view. (slide up: < 0, slide down: 0 >)
isSwiping Indicates whether the user is swiping the item or not

public abstract void setAfterSwipeReaction (int reaction)

Sets the reaction type of after swiping item.

public abstract void setMaxDownSwipeAmount (float amount)

Sets the maximum item down swipe amount.

Parameters
amount Item swipe amount. If the item is configured as proportional amount mode, specify limit amount in range of [-1.0 .. 1.0]. Otherwise, specify limit distance in pixels.

public abstract void setMaxLeftSwipeAmount (float amount)

Sets the maximum item left swipe amount.

Parameters
amount Item swipe amount. If the item is configured as proportional amount mode, specify limit amount in range of [-1.0 .. 1.0]. Otherwise, specify limit distance in pixels.

public abstract void setMaxRightSwipeAmount (float amount)

Sets the maximum item right swipe amount.

Parameters
amount Item swipe amount. If the item is configured as proportional amount mode, specify limit amount in range of [-1.0 .. 1.0]. Otherwise, specify limit distance in pixels.

public abstract void setMaxUpSwipeAmount (float amount)

Sets the maximum item up swipe amount.

Parameters
amount Item swipe amount. If the item is configured as proportional amount mode, specify limit amount in range of [-1.0 .. 1.0]. Otherwise, specify limit distance in pixels.

public abstract void setProportionalSwipeAmountModeEnabled (boolean enabled)

Sets proportional swipe amount mode enabled.

Parameters
enabled True if swipe amount is specified in proportional value, otherwise amount is specified in pixels.

public abstract void setSwipeItemHorizontalSlideAmount (float amount)

Sets the amount of horizontal swipe.

Parameters
amount Item swipe amount. Generally the range is [-1.0 .. 1.0] if the proportional amount mode is enabled, otherwise distance in pixels. In additionally, these special values can also be accepted; - OUTSIDE_OF_THE_WINDOW_LEFT - OUTSIDE_OF_THE_WINDOW_RIGHT

public abstract void setSwipeItemVerticalSlideAmount (float amount)

Sets the amount of vertical swipe.

Parameters
amount Item swipe amount. Generally the range is [-1.0 .. 1.0] if the proportional amount mode is enabled, otherwise distance in pixels. In additionally, these special values can also be accepted; - OUTSIDE_OF_THE_WINDOW_TOP - OUTSIDE_OF_THE_WINDOW_BOTTOM

public abstract void setSwipeResult (int result)

Sets the result code of swiping item.

Parameters
result Result code. One of these values; - RESULT_NONE - RESULT_SWIPED_LEFT - RESULT_SWIPED_UP - RESULT_SWIPED_RIGHT - RESULT_SWIPED_DOWN - RESULT_CANCELED

public abstract void setSwipeStateFlags (int flags)

Sets the state flags value for swiping item

Parameters
flags Bitwise OR of these flags; - STATE_FLAG_SWIPING - STATE_FLAG_IS_ACTIVE - STATE_FLAG_IS_UPDATED
See Also