Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomsh committed May 21, 2018
1 parent 8d0b1e6 commit 22af3ba
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Gradle
```groovy
dependencies{
compile 'com.github.wenchaosong:banner:2.1.1' //最新版本
compile 'com.github.wenchaosong:banner:2.1.2' //最新版本
}
```
或者引用本地lib
Expand Down
19 changes: 19 additions & 0 deletions rollbanner/src/main/java/com/ms/banner/Banner.java
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,25 @@ public void onPageScrollStateChanged(int state) {
if (mOnPageChangeListener != null) {
mOnPageChangeListener.onPageScrollStateChanged(state);
}

switch (state) {
case 0://No operation
if (currentItem == 0) {
viewPager.setCurrentItem(count, false);
} else if (currentItem == count + 1) {
viewPager.setCurrentItem(1, false);
}
break;
case 1://start Sliding
if (currentItem == count + 1) {
viewPager.setCurrentItem(1, false);
} else if (currentItem == 0) {
viewPager.setCurrentItem(count, false);
}
break;
case 2://end Sliding
break;
}
}

@Override
Expand Down

0 comments on commit 22af3ba

Please sign in to comment.