therealshabi / AutoImageFlipper

Auto Scrolling Image Pager with Pager Indicator and Text
Apache License 2.0
106 stars 25 forks source link

Fix an issue causing the ViewPager to scrolls back immediately to the first item when there are only two items #39

Closed Sonphil closed 4 years ago

Sonphil commented 4 years ago

Fix issue #38

When onPageScrolled is called, if we detect that the user is dragging the ViewPager (SCROLL_STATE_DRAGGING) and have reached the edge (positionOffset == 0f), we change the current item when the user stops dragging (when onPageScrollStateChanged is called).

The ViewPager doesn't scrolls back immediately to the first item anymore. ezgif-6-fc4aba288596