CardStackView
CardStackView copied to clipboard
How to get the position where card was swiped ?
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
my case I have to keep a field onCardSwipe(position)
you can update the current card position by
@Override public void onCardAppeared(View view, int position) { currentPos = position; }
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