Closed rosuH closed 3 years ago
Yep, I have been tested in ViewPager and ViewPager2. Seen works fine. 😆
Sorry for the slow response. Github did not email me :D, and I have submitted the changes as per your suggestion. Please review the code again.
What the problem
The
onTabReselected
also been called when the tab is first selected.What caused it
When the user selects a tab, would have followed call chain:
As you can see, when you call
ViewPager.setCurrentItem()
, theViewPager
will invokeonPageSelected
automatically. So thatTabAdapter#selectTab
would be call in second times. That is whyonTabReselected
also been called when the tab is first selected.How to fix it?
In
ViewPgaer.onPageScrollStateChanged
, I adding some code to detect whether if user touch or programmatically call from code. Here is the ref.This lib is awesome, Thanks for your work :D