romandanylyk / PageIndicatorView

An page indicator for Android ViewPager
4.62k stars 563 forks source link

re-register DataSetObserver whenever the PagerAdapter changes #102

Closed froqstar closed 5 years ago

froqstar commented 5 years ago

Problem

If app:piv_dynamicCount="true" is set, we register a DataSetObserver on the PagerAdapter of the ViewPager to get notified of data changes and update the page count accordingly. If however the PagerAdapter changes later on, we don't re-register on the new PagerAdapter and thus fail to update the page count for future data set changes of the ViewPager.

Solution

Re-register the DataSetObserver whenever the PagerAdapter changes.

romandanylyk commented 5 years ago

Nice fix here @froqstar , thanks for the pull-request