Skip to content

Dynamic view margin, Undo last swipe, Putback swiped view, Lock view

Compare
Choose a tag to compare
@janishar janishar released this 19 Oct 23:00

This Version adds several new functionality to the SwipePlaceHolderView:

I. Dynamic view margin: This will allow to specify margin for placing cards at appropriate position programmatically.
example: mSwipePlaceHolderView is the SwipePlaceHolderView layout

mSwipePlaceHolderView.setSwipeDecor(new SwipeDecor()
                        .setMarginTop(300)
                        .setMarginLeft(100)
                        .setViewGravity(Gravity.TOP)

Note:

  1. This will place the card at 300 pixel from top and 100 pixel from left.
  2. If setViewGravity(Gravity.TOP) is not provided then the margin will take place from the center on the screen.

II. Undo last swipe: This will allow to put the last swiped view back on the top.
Example:

//It initializes the Undo functionality
mSwipePlaceHolderView.getBuilder() .setIsUndoEnabled(true)

//To undo call this method
mSwipePlaceHolderView.undoLastSwipe();

III. Putback swiped view: This functionality enable the card to be swiped and then animate back on the top. So, user is not able to swipe other cards other than top.

Example:

//Activates the Putback functionality
mSwipePlaceHolderView.activatePutBack();

//Deactivates the Putback functionality
mSwipePlaceHolderView.deActivatePutBack();

IV. Lock view: This allows the card to be locked. The user will not be able to swipe the locked cards.

Example:

//It locks the card view
mSwipePlaceHolderView.lockViews();

//It Unlocks the locked card view
mSwipePlaceHolderView.unlockViews();