Skip to content

Commit

Permalink
Update for issue #280,set auto play smoothly supported.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhpanvip committed Sep 10, 2022
1 parent 188ab74 commit 9ddda6d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ private void pageScrolled(int position, float positionOffset, int positionOffset

private void handlePosition() {
if (mBannerPagerAdapter != null && mBannerPagerAdapter.getListSize() > 1 && isAutoPlay()) {
mViewPager.setCurrentItem(mViewPager.getCurrentItem() + 1);
mViewPager.setCurrentItem(mViewPager.getCurrentItem() + 1,
mBannerManager.getBannerOptions().isAutoScrollSmoothly());
mHandler.postDelayed(mRunnable, getInterval());
}
}
Expand Down Expand Up @@ -1141,6 +1142,15 @@ public BannerViewPager<T> showIndicatorWhenOneItem(boolean showIndicatorWhenOneI
return this;
}

/**
* @param autoScrollSmoothly is auto play scroll smoothly.
*/
public BannerViewPager<T> setAutoPlaySmoothly(boolean autoScrollSmoothly) {
mBannerManager.getBannerOptions()
.setAutoScrollSmoothly(autoScrollSmoothly);
return this;
}

/**
* @deprecated Use {@link BannerViewPager#disallowParentInterceptDownEvent(boolean)} instead.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public BannerOptions() {

private boolean stopLoopWhenDetachedFromWindow = true;

private boolean autoScrollSmoothly = true;

private final IndicatorOptions mIndicatorOptions;

public int getInterval() {
Expand Down Expand Up @@ -231,6 +233,14 @@ public void setIndicatorMargin(int left, int top, int right, int bottom) {
mIndicatorMargin = new IndicatorMargin(left, top, right, bottom);
}

public boolean isAutoScrollSmoothly() {
return autoScrollSmoothly;
}

public void setAutoScrollSmoothly(boolean autoScrollSmoothly) {
this.autoScrollSmoothly = autoScrollSmoothly;
}

public float[] getRoundRectRadiusArray() {
return roundRadiusArray;
}
Expand Down

0 comments on commit 9ddda6d

Please sign in to comment.