Skip to content

Commit 41e00e4

Browse files
committed
Fix for issue #31
1 parent 8f9899b commit 41e00e4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/src/main/java/com/nshmura/recyclertablayout/RecyclerTabLayout.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,7 @@ protected void scrollToTab(int position, float positionOffset, boolean fitIndica
290290
mRequestScrollToTab = true;
291291
}
292292

293-
if (mAdapter != null && mIndicatorPosition != position) {
294-
updateCurrentIndicatorPosition(position, positionOffset - mOldPositionOffset,
295-
positionOffset);
296-
}
293+
updateCurrentIndicatorPosition(position, positionOffset - mOldPositionOffset, positionOffset);
297294
mIndicatorPosition = position;
298295

299296
stopScroll();
@@ -311,6 +308,9 @@ protected void scrollToTab(int position, float positionOffset, boolean fitIndica
311308
}
312309

313310
protected void updateCurrentIndicatorPosition(int position, float dx, float positionOffset) {
311+
if (mAdapter == null) {
312+
return;
313+
}
314314
int indicatorPosition = -1;
315315
if (dx > 0 && positionOffset >= mPositionThreshold - POSITION_THRESHOLD_ALLOWABLE) {
316316
indicatorPosition = position + 1;

0 commit comments

Comments
 (0)