Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapter initialization and updateDataSet with no notifyItemXXX() #144

Closed
Bylynka opened this issue Jul 18, 2016 · 8 comments
Closed

Adapter initialization and updateDataSet with no notifyItemXXX() #144

Bylynka opened this issue Jul 18, 2016 · 8 comments
Milestone

Comments

@Bylynka
Copy link

Bylynka commented Jul 18, 2016

Hi thanks for your job!

I tried to use 5.0.0-b7 for sticky headers. But it looks like it doesn't work correctly yet(list jums when it is scrolled).
Than I tried 5.0.0-SNAPSHOT. It works correctly, but dropdown animation appears when call updateDataSet method is called.
How can I disable this animation?

@davideas
Copy link
Owner

Hi @Bylynka, thank you!
But what do you mean with dropdown animation?

@Bylynka
Copy link
Author

Bylynka commented Jul 18, 2016

Please look at the video https://www.youtube.com/watch?v=da6dcHgjFrA
on 'PITCHES' tab I extend FlexibleAdapter on 'TOPICS' tab I extend RecyclerView.Adapter.
On 'PITCHES' tab you can see this animation( when updateDataSet is called).

@davideas
Copy link
Owner

davideas commented Jul 18, 2016

What you see, is the insert of the headers that is done with a notification of notiyItemInserted().
showAllHeaders is also called in more parts of the adapter, to restore the initial set.

And the item is animated in such way, also because defaultAnimator is set in the recyclerView.

Actually you can't disable. I don't know if I can remove it, I will need to redesign some methods. But that effect is not that bad I think.

@Bylynka
Copy link
Author

Bylynka commented Jul 19, 2016

Thank you for answer! I agree with you that effect is not bad. But for current project I need list without any effects..

@davideas
Copy link
Owner

I will see what I can do, but I can't assure when it can be done.

@davideas davideas changed the title Drop down animation for Sticky headers Adapter initialization and updateDataSet with no notifyItemXXX() Jul 19, 2016
@Bylynka
Copy link
Author

Bylynka commented Jul 19, 2016

Thank you. It will be great.

@davideas
Copy link
Owner

davideas commented Jul 20, 2016

OK, yesterday I wanted to check something on this issue. For the moment the new code is valid only for updateDataSet(). Initialization works as before with the notifications.

In experiments branch I added the new code to skip all notifyItemXXX() only when animate is set false. Just before calling notifyDataSetChanged(), I complete the adapter set with expandables expanded and headers to be shown. Which means no effects at all when new items are fetched or items are removed from the list.

This can be obtained by calling updateDataSet(items) or updateDataSet(items, false). This was already in place but subItems and headers were applied after the notifyDataSetChanged(). Now they are added before.
In the demoApp I added a checkMenuBox to see the difference when animate = true or false:

  • When true it synchronizes all new and existent items with notifyItemXXX().
  • When false it doesn't make any animation, because notifyDataSetChanged() is called.

@Bylynka, you can check the demoApp in that branch.

@Bylynka
Copy link
Author

Bylynka commented Jul 20, 2016

Great! I tried it and it is exactly what I need. Will you add these updates to release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants