MaterialList icon indicating copy to clipboard operation
MaterialList copied to clipboard

Incorrect removing card from other fragment

Open stasusov opened this issue 10 years ago • 6 comments

I have ViewPager and simple class extending FragmentPagerAdapter with some fragments and identical cards in them. When i dismiss card from first, it is also removing from second fragment.

stasusov avatar Apr 28 '15 06:04 stasusov

Identical cards means same objects?

If you remove an object from the list, and you use the same source for different lists, then all the lists will reflect that change.

I you do not want that to happen, you should create the cards for each list, instead of sharing the same objects (But that's OOP related, not directly with MaterialList)

dexafree avatar Apr 28 '15 14:04 dexafree

I wasn't correct. I have some dynamically created tabs. In each i'm using same simple method to create and add cards by clicking on the button. Then, when I dismiss card in one tab, it is also removing from the second. So, as i suppose, cards in this example are not the same objects. Identical cards meant they are looking same, have same information in it.

stasusov avatar Apr 28 '15 16:04 stasusov

Doy you create new cards in every tab? (Calling new Card/BasicButtonsCard.... creating NEW objects, not getting them from an array)

That might be the problem :worried:

dexafree avatar Apr 29 '15 13:04 dexafree

No, every time i'm using Somecard sc = new SomeCard() where Somecard is inherited from SimpleCard by all rules

stasusov avatar Apr 29 '15 17:04 stasusov

Ok, this is a specific case, I think.

Are you importing the library by module or by gradle.

I'd like to see the output of these line in every MaterialList instance: https://github.com/dexafree/MaterialList/blob/master/materialList/src/main/java/com/dexafree/materialList/view/MaterialListView.java#L169

(sincerely, I have not tested having more than one instance of MaterialList simultaneously running)

dexafree avatar Apr 29 '15 21:04 dexafree

If I haven't missed something, this method wasn't even called. UPD: Maybe the problem is in adapter?

stasusov avatar May 01 '15 08:05 stasusov