Skip to content

Commit

Permalink
[fix #55] Fix ArrayIndexOutOfBoundsException when there is 0 or 1 item
Browse files Browse the repository at this point in the history
  • Loading branch information
tommybuonomo committed Sep 10, 2019
1 parent 66f3470 commit 746bb77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions viewpagerdotsindicator-sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".viewpager.ViewPagerActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name=".viewpager2.ViewPager2Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ abstract class OnPageChangeListenerHelper {
}
val leftPosition = offset.toInt()
val rightPosition = leftPosition + 1

if (rightPosition > lastPageIndex || leftPosition == -1) {
return
}

onPageScrolled(leftPosition, rightPosition, offset % 1)

if (lastLeftPosition != -1) {
Expand Down

0 comments on commit 746bb77

Please sign in to comment.