Skip to content

Conversation

@stumi01
Copy link

@stumi01 stumi01 commented Mar 20, 2018

We encountered a problem ,
when you have multiple view types defined in the adapter with multiple view holders.
If the view got recycled but the new child is a different type it's got ignored.

In the fix I compare the existing child with the new one and if the viewHolder is different i drop the previous child.

container.setDraggable(false);
ViewGroup parent = container.getContentContainer();
View child = adapter.getView(lastIndex, parent.getChildAt(0), parent);
if (parent.getChildCount() != 0 && !parent.getChildAt(0).getTag().equals(child.getTag())) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happen if the tag is null? or empty for the both

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, I was assuming the recommended design but its not mandatory.
Gonna fix that.

@jemshit jemshit mentioned this pull request Jun 24, 2018
@yuyakaido
Copy link
Owner

@stumi01 @luongvo
Thank you for your contribution!
This improvements have been included in ver. 2.0.0.


Sorry, ver. 2.0.0 is fully re-implemented by RecyclerView, so it's difficult to merge your PR.

@yuyakaido yuyakaido closed this Nov 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants