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

Issue with header when refresh and load #110

Closed
mdtuyen opened this issue Jun 8, 2016 · 6 comments
Closed

Issue with header when refresh and load #110

mdtuyen opened this issue Jun 8, 2016 · 6 comments
Labels

Comments

@mdtuyen
Copy link

mdtuyen commented Jun 8, 2016

I applied new version 7/7/2016 and see:

  • When I disable header (ULSItem) with setDisplayHeadersAtStartUp(false) => refresh => ULSItem showed
  • Load more item with expandable => seem to expandItemsAtStartUp not work. New item not expanded.
@davideas
Copy link
Owner

davideas commented Jun 8, 2016

Hi @mdtuyen, for the first point, in the current build, I do not have that behavior: ULSItem is marked done in the Singleton and so cannot be displayed anymore, it is added in the ExampleAdapter.updateDataSet(), there's is a check if it has to be added or not. I think there's no issue.

The second point, for the moment, I removed the auto-expand in combination with loadMore, ie. all addItems: Developer has to manually expand new items.

@mdtuyen
Copy link
Author

mdtuyen commented Jun 9, 2016

@davideas Thanks for your reply. I want to ask about sticky header in my project after i use new version of FlexibleAdapter Stickyheader have been disable. What is the condition of header to sticky ? enablesticky for Adapter, Header item extend of IHeader or anymore ?

And must i put adapter.expand(i) when I add element to position i of adapter to expand that item ?

@mdtuyen
Copy link
Author

mdtuyen commented Jun 9, 2016

Hi @davideas, I want to add some Layout Item to top of recyclerview and them don't change when refresh or load more. What is the best solution to implement it ?

@davideas
Copy link
Owner

davideas commented Jun 9, 2016

@mdtuyen, I wrote it in the release note of the snapshot, to avoid the bugs you need to pass also a new paramter true to the super constructor of the ViewHolder for the header view. This creates a new middle layout that will become sticky avoiding all those crashing bugs.

For the second question, if the layout remains fixed, it is not part of the RV, therefore the Adapter is not involved it's not an item but a simple layout on the top of the RV. It cannot be otherwise

@mdtuyen
Copy link
Author

mdtuyen commented Jun 9, 2016

With second question I think it is same with header, footer of listview. In your demo, you need re add them when refresh or init data. Is there simpler solution ?

@davideas
Copy link
Owner

davideas commented Jun 9, 2016

Yes there is!
You need to add that special header item to the collection before this is passed to the adapter, so that, the animateTo is able to recognize its presence and it doesn't change position.
Override updateDataSet() and before calling super() add the header item at position 0.

animateTo has been revisited, now it works quite well, but don't abuse it for large 500/1000+ items it makes 3 times the calculation to check if all items has to be removed/added/moved from the original list.

davideas added a commit that referenced this issue Jun 10, 2016
Adjusted selection flags when removing items.
Fixed small bug when restoring items after applying the filter and vice-versa.
@mdtuyen mdtuyen closed this as completed Jun 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants