Swipecards icon indicating copy to clipboard operation
Swipecards copied to clipboard

Top card doesn't change on NotifyDataSetChanges

Open t27 opened this issue 10 years ago • 11 comments

I am using an arraylist in my adapter as the data source for the cards. On a button toggle, I have to change the cards displayed. Hence I call the clear() function of my array and then do an addAll() with the required data. Followed by a call to the adapters notifyDataSetChanged()

The data does change but the first card is the same as what i saw before the button toggle. on swiping away this card I see that the next card is the second card of my second list(and same for the 3rd,4th etc hence I conclude the data has changed). But why didn't the first card refresh to show the new list?

t27 avatar Dec 27 '14 18:12 t27

Same issue

current workaround is adding a blank page onto the first page and call selectRight()

dlangerenken avatar Jan 05 '15 01:01 dlangerenken

I have the same issue also

RadicalMonkey avatar Jan 05 '15 09:01 RadicalMonkey

I resolved this issue by adding this method in SwipeFlingAdapterView

    public void reset() {
        this.mActiveCard = null;
        requestLayout();
    }

Just call reset() when you need to reset the SwipeFlingAdapterView

qichuan avatar Jan 06 '15 09:01 qichuan

I solved this by using flingContainer.removeAllViewsInLayout();

hunterTR avatar Mar 10 '15 21:03 hunterTR

Nice Solution for toggle card that is already left

jayantibutani avatar May 07 '15 09:05 jayantibutani

Also got this issue on version 1.0.8. Workaround flingContainer.removeAllViewsInLayout(); before notifyDataSetChanged() worked aswell, no need to change lib's code.

meynetySII avatar Jun 15 '15 15:06 meynetySII

removeAllViewsInLayout worked for me too, thanks :smile:

AlanVerbner avatar Jul 02 '15 00:07 AlanVerbner

@Diolor : Can you please add this in the Readme of this library? It will be really helpful since I feel it's one of the very common operations that people would be looking for

Aman-Aalam avatar Sep 02 '15 05:09 Aman-Aalam

Was using selectRight() earlier But removeAllViewsInLayout() is pretty neat workaround. Thanks

raevilman avatar Feb 02 '16 09:02 raevilman

+1 for flingContainer.removeAllViewsInLayout();

tobiasschuerg avatar Mar 04 '16 15:03 tobiasschuerg

When I use removeAllViewsInLayout(), I currently have the issue that the flingadapter is either not showing images, or swiping does not work until I press the button I have for swiping left/right, so triggering it manually

boylenssen avatar May 30 '17 07:05 boylenssen