Skip to content
This repository has been archived by the owner on Apr 23, 2019. It is now read-only.

Setups indices on attached instead of constructor #6

Merged
merged 1 commit into from
Oct 6, 2015
Merged

Setups indices on attached instead of constructor #6

merged 1 commit into from
Oct 6, 2015

Conversation

Sloy
Copy link
Contributor

@Sloy Sloy commented Oct 5, 2015

Removes the call to setupIndices() indirectly invoked by notifyDataSetChanged() in the constructor. Instead, the initial setup of indices get's done in onAttachedToRecyclerView(), when the adapter has been created and initialized probably.

This fixes the problem with calling child's getSectionCount() when it depends on non-null fields initialization at construction time, since the parent constructor get's called before the child's.

Fixes #3 and #4

Also, I removed super.onChanged(); in SectionDataObserver since the parent method is empty.

onAttachedToRecyclerView() is the best place for the initialization that I could find, can't assure it is the best one. But I don't see a reason not to use it.

Hope it helps!

Removes the call to setupIndices() indirectly invoked by notifyDataSetChanged() in the constructor. Instead, the initial setup of indices get's done in onAttachedToRecyclerView(), when the adapter has been created and initialized probably.

This fixes the problem with calling child's getSectionCount() when it depends on non-null fields initialization at construction time, since the parent constructor get's called before the child's.

This fixes #3 and #4
truizlop added a commit that referenced this pull request Oct 6, 2015
Setups indices on attached instead of constructor
@truizlop truizlop merged commit a3faf45 into truizlop:master Oct 6, 2015
@pratamawijaya
Copy link

for these change, it has been updated to new version..? because im still found these bug #3

@truizlop
Copy link
Owner

I am preparing a new release which will be published within a few days. I'll notify you here when it's done.

@Sloy Sloy deleted the feature/fix-premature-indices-setup branch October 16, 2015 09:35
@truizlop
Copy link
Owner

@pratamawijaya new version 1.1.0 has been published fixing the issue

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

Successfully merging this pull request may close these issues.

Nullpointer when set section count from list size
3 participants