You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
Thank you so much for this wonderful library. It is very useful and has helped me immensely.
But I found an issue with using setCurrentItem on my viewPager.
Here is the flow :
I have initialized the ViewPager, PagerAdapter and InkPageIndicator
testAdapter = new SimplePagerAdapter(testList);
testPager.setAdapter(testAdapter);
testIndicator.setViewPager(testPager);
Then I add few views to testList and call notifyDataSetChanged on testAdapter.
(Which internally calls setPageCount and pageCount gets initialized correctly, which internally calls requestLayout , which would be called on next idle cycle)
testList.add(newView);
testPager.getAdapter().notifyDataSetChanged();
Then I immediately call setCurrentItem(newViewIndex, false);
which calls setPageSelected inline which calls setSelectedPage. setSelectedPage tries to call
createMoveSelectedAnimator but dotCenterX doesn't contain newly added view's dot's X value. This is because calculateDotPositions isn't called as yet since onMeasure is not called as yet and is waiting to be called in idle cycle.
Could you please give me a suggestion on how can I fix this. I would create the patch and create pull request for the same.
The text was updated successfully, but these errors were encountered:
Hi,
Thank you so much for this wonderful library. It is very useful and has helped me immensely.
But I found an issue with using setCurrentItem on my viewPager.
Here is the flow :
I have initialized the ViewPager, PagerAdapter and InkPageIndicator
testAdapter = new SimplePagerAdapter(testList);
testPager.setAdapter(testAdapter);
testIndicator.setViewPager(testPager);
Then I add few views to testList and call notifyDataSetChanged on testAdapter.
(Which internally calls setPageCount and pageCount gets initialized correctly, which internally calls requestLayout , which would be called on next idle cycle)
testList.add(newView);
testPager.getAdapter().notifyDataSetChanged();
Then I immediately call setCurrentItem(newViewIndex, false);
which calls setPageSelected inline which calls setSelectedPage. setSelectedPage tries to call
createMoveSelectedAnimator but dotCenterX doesn't contain newly added view's dot's X value. This is because calculateDotPositions isn't called as yet since onMeasure is not called as yet and is waiting to be called in idle cycle.
Could you please give me a suggestion on how can I fix this. I would create the patch and create pull request for the same.
The text was updated successfully, but these errors were encountered: