yuyakaido / CardStackView

📱Tinder like swipeable card view for Android
Apache License 2.0
2.37k stars 448 forks source link

Bug: Reloading doesn't work properly #272

Closed geekytechie closed 4 years ago

geekytechie commented 5 years ago

On reloading the CardStackView at the last position, the card get stucks in the air. Attached is the screenshot.

@Override
public void onCardDisappeared(View view, int position) {
    if(position == (arrayList.size()-1)){
        cardStackView.getAdapter().notifyDataSetChanged();
    }
}

device-2019-08-08-201355

bashizip commented 5 years ago

Try this instead

   @Override
    public void onCardAppeared(View view, int position) {
        resetMap(yourList.get(position));
    }

And

  @Override
    public void onCardSwiped(Direction direction) {
        if (layoutManager.getTopPosition() == (yourList.size())) {
            adapter.notifyDataSetChanged();
        }
    }
yuyakaido commented 4 years ago

@geekytechie We should implement reloading in onCardSwiped not in onCardDisappeared as @bashizip mentioned.