Skip to content

Commit

Permalink
showIndicatorWhenOneItem supported.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhpanvip committed Jun 21, 2021
1 parent 6703c4a commit 4d06519
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bannerview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ android {

dependencies {
implementation 'androidx.viewpager2:viewpager2:1.0.0'
api 'com.github.zhpanvip:viewpagerindicator:1.2.0'
api 'com.github.zhpanvip:viewpagerindicator:1.2.1'
// api project(path: ':indicator')
}
11 changes: 11 additions & 0 deletions bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,17 @@ public BannerViewPager<T> stopLoopWhenDetachedFromWindow(boolean stopLoopWhenDet
return this;
}

/**
*
* @param showIndicatorWhenOneItem 只有一个item时是否显示指示器,
* true:显示,false:不显示,默认值false
*/
public BannerViewPager<T> showIndicatorWhenOnItem(boolean showIndicatorWhenOneItem) {
mBannerManager.getBannerOptions()
.showIndicatorWhenOnItem(showIndicatorWhenOneItem);
return this;
}

/**
* @deprecated Use {@link BannerViewPager#disallowParentInterceptDownEvent(boolean)} instead.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ class DrawableIndicator @JvmOverloads constructor(
}
}

override fun rotateCanvas(canvas: Canvas) {
}

private fun drawIcon(
canvas: Canvas,
left: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ public void setIndicatorSliderWidth(int normalWidth, int checkedWidth) {
mIndicatorOptions.setSliderWidth(normalWidth, checkedWidth);
}

public void showIndicatorWhenOnItem(boolean showIndicatorWhenOneItem){
mIndicatorOptions.setShowIndicatorOneItem(showIndicatorWhenOneItem);
}

public int getCheckedIndicatorWidth() {
return (int) mIndicatorOptions.getCheckedSliderWidth();
}
Expand Down

0 comments on commit 4d06519

Please sign in to comment.