I'm using the library CardStackView by yuyakaido and I can't seem to make the CardStackListener work. Here is the link to the library:
https://github.com/yuyakaido/CardStackView#callbacks
I have implemented it to my Fragment.
public class PendingFragment extends Fragment implements CardStackListener{
private CardStackLayoutManager manager;
private CardStackView cardStackView;
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View mView = inflater.inflate(R.layout.fragment_pending, container, false);
manager = new CardStackLayoutManager(getActivity());
manager.setStackFrom(StackFrom.Top);
manager.setVisibleCount(3);
manager.setCanScrollVertical(false);
cardStackView = mView.findViewById(R.id.pendingList_cardStackView);
cardStackView.setLayoutManager(manager);
}
@Override
public void onCardDragging(Direction direction, float ratio) {
}
@Override
public void onCardSwiped(Direction direction) {
Log.e("PendingFragment", "onCardSwiped: " + direction );
if(direction == Direction.Right){
Toast.makeText(getActivity(), "Accepted", Toast.LENGTH_SHORT).show();
}else if(direction == Direction.Left){
Toast.makeText(getActivity(), "Rejected", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onCardRewound() {
}
@Override
public void onCardCanceled() {
}
@Override
public void onCardAppeared(View view, int position) {
}
@Override
public void onCardDisappeared(View view, int position) {
}
}
The swipe works but there are no callbacks. Am I missing something here?
EDIT: I'm using gradle:
implementation "com.yuyakaido.android:card-stack-view:2.2.0".
I'm also using FirebaseRecyclerAdapter as my adapter