CardStackView icon indicating copy to clipboard operation
CardStackView copied to clipboard

How to get the position where card was swiped ?

Open eflexcode opened this issue 5 years ago • 3 comments

if a card was swiped right how can i also know the position so i can so i can get user details and notify user that some one like him/she

eflexcode avatar May 21 '20 17:05 eflexcode

my case I have to keep a field onCardSwipe(position)

dbof10 avatar Jun 05 '20 13:06 dbof10

you can update the current card position by @Override public void onCardAppeared(View view, int position) { currentPos = position; }

anubhav11march avatar Jul 04 '20 07:07 anubhav11march

Simple you just have to make sure your class is implementing CardStackListener

And that's how you can do this:

lateinit var cardStackLayoutManager: CardStackLayoutManager

And onViewCreated method just initialise like this

cardStackLayoutManager = CardStackLayoutManager(context, this)

So you would have call back for this method on this card change

override fun onCardAppeared(view: View?, position: Int) {
     if (position == cardStackAdapter.itemCount - 1) {
         cardStackLayoutManager.setSwipeableMethod(SwipeableMethod.None)
         cardStackView.rewind()
     }
     else {
         cardStackLayoutManager.setSwipeableMethod(SwipeableMethod.Manual)
     }
 }

@eflexcode

BabarShamsi-mset avatar Nov 18 '21 08:11 BabarShamsi-mset