handle onPageSelected called twice on every page change

This commit is contained in:
tibbi 2017-12-17 11:46:41 +01:00
parent 9751daa8af
commit 8843a4a006

View file

@ -860,11 +860,14 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
if (view_pager.offscreenPageLimit == 1) { if (view_pager.offscreenPageLimit == 1) {
view_pager.offscreenPageLimit = 2 view_pager.offscreenPageLimit = 2
} }
mPos = position
updateActionbarTitle() if (mPos != position) {
mRotationDegrees = 0f mPos = position
supportInvalidateOptionsMenu() updateActionbarTitle()
scheduleSwipe() mRotationDegrees = 0f
supportInvalidateOptionsMenu()
scheduleSwipe()
}
} }
override fun onPageScrollStateChanged(state: Int) { override fun onPageScrollStateChanged(state: Int) {