-
Notifications
You must be signed in to change notification settings - Fork 222
Open
Description
Sometimes when I change position of ViewPager I see that current tab at RecyclerTabLayout stay the same. I've figure out after some debugging where is problem.
See at method updateCurrentIndicatorPosition. This method don't change adapter's indicatorPosition if dx is 0. So RecyclerTabLayout's position and ViewPager's position do not match.
RecyclerTabLayout/library/src/main/java/com/nshmura/recyclertablayout/RecyclerTabLayout.java
Lines 310 to 325 in 16e4140
| protected void updateCurrentIndicatorPosition(int position, float dx, float positionOffset) { | |
| if (mAdapter == null) { | |
| return; | |
| } | |
| int indicatorPosition = -1; | |
| if (dx > 0 && positionOffset >= mPositionThreshold - POSITION_THRESHOLD_ALLOWABLE) { | |
| indicatorPosition = position + 1; | |
| } else if (dx < 0 && positionOffset <= 1 - mPositionThreshold + POSITION_THRESHOLD_ALLOWABLE) { | |
| indicatorPosition = position; | |
| } | |
| if (indicatorPosition >= 0 && indicatorPosition != mAdapter.getCurrentIndicatorPosition()) { | |
| mAdapter.setCurrentIndicatorPosition(indicatorPosition); | |
| mAdapter.notifyDataSetChanged(); | |
| } | |
| } |
Metadata
Metadata
Assignees
Labels
No labels