Browse Source

Fix bug and add indicator slide mode sample in IndicatorFragment

zhpanvip 5 years ago
parent
commit
836d070469

+ 2 - 1
app/src/main/java/com/example/zhpan/circleviewpager/fragment/HomeFragment.java

@@ -137,9 +137,10 @@ public class HomeFragment extends BaseFragment {
     private void initBanner() {
         mViewPager
                 .setAutoPlay(true)
-                .setIndicatorSlideMode(IndicatorSlideMode.SMOOTH)
+                .setIndicatorSlideMode(IndicatorSlideMode.WORM)
                 .setInterval(5000)
                 .setScrollDuration(1200)
+                .setIndicatorRadius(getResources().getDimensionPixelSize(R.dimen.dp_3))
                 .setIndicatorView(mIndicatorView)// 这里为了设置标题故用了自定义Indicator,如果无需标题则没必要添加此行代码
                 .setIndicatorColor(getColor(R.color.red_normal_color), getColor(R.color.red_checked_color))
                 .setHolderCreator(NetViewHolder::new)

+ 59 - 24
app/src/main/java/com/example/zhpan/circleviewpager/fragment/IndicatorFragment.java

@@ -9,6 +9,7 @@ import android.widget.RadioGroup;
 import com.example.zhpan.circleviewpager.R;
 import com.example.zhpan.circleviewpager.viewholder.ImageResourceViewHolder;
 import com.zhpan.bannerview.BannerViewPager;
+import com.zhpan.bannerview.annotation.AIndicatorSlideMode;
 import com.zhpan.bannerview.constants.IndicatorGravity;
 import com.zhpan.bannerview.constants.IndicatorSlideMode;
 import com.zhpan.bannerview.constants.IndicatorStyle;
@@ -21,8 +22,12 @@ import com.zhpan.idea.utils.ToastUtils;
 public class IndicatorFragment extends BaseFragment {
 
     private BannerViewPager<Integer, ImageResourceViewHolder> mViewPager;
-    private RadioGroup radioGroupStyle;
+    private RadioGroup mRadioGroupStyle;
+    private RadioGroup mRadioGroupMode;
     private RadioButton radioButton;
+    private @AIndicatorSlideMode
+    int mSlideMode = IndicatorSlideMode.WORM;
+    private int mCheckId = R.id.rb_circle;
 
     @Override
     protected int getLayout() {
@@ -53,7 +58,8 @@ public class IndicatorFragment extends BaseFragment {
     @Override
     protected void initView(Bundle savedInstanceState, View view) {
         radioButton = view.findViewById(R.id.rb_circle);
-        radioGroupStyle = view.findViewById(R.id.rg_indicator_style);
+        mRadioGroupStyle = view.findViewById(R.id.rg_indicator_style);
+        mRadioGroupMode = view.findViewById(R.id.rg_slide_mode);
         mViewPager = view.findViewById(R.id.banner_view);
         mViewPager.setIndicatorGap(BannerUtils.dp2px(6))
                 .setRoundCorner(BannerUtils.dp2px(6))
@@ -66,68 +72,97 @@ public class IndicatorFragment extends BaseFragment {
     }
 
     private void initRadioGroup() {
-        radioGroupStyle.setOnCheckedChangeListener((group, checkedId) -> {
+        mRadioGroupStyle.setOnCheckedChangeListener((group, checkedId) -> checkedChange(mCheckId = checkedId));
+        radioButton.performClick();
+        mRadioGroupMode.setOnCheckedChangeListener((group, checkedId) -> {
             switch (checkedId) {
-                case R.id.rb_circle:
-                    setupCircleIndicator();
-                    break;
-                case R.id.rb_dash:
-                    setupDashIndicator();
+                case R.id.rb_normal:
+                    mSlideMode = IndicatorSlideMode.NORMAL;
                     break;
-                case R.id.rb_round_rect:
-                    setupRoundRectIndicator();
+                case R.id.rb_worm:
+                    mSlideMode = IndicatorSlideMode.WORM;
                     break;
-                case R.id.rb_tmall:
-                    setupTmallIndicator();
+                case R.id.rb_smooth:
+                    mSlideMode = IndicatorSlideMode.SMOOTH;
                     break;
             }
+            checkedChange(mCheckId);
         });
-        radioButton.performClick();
     }
 
-    private void setupTmallIndicator() {
+    private void checkedChange(int checkedId) {
+        switch (checkedId) {
+            case R.id.rb_circle:
+                setupCircleIndicator();
+                break;
+            case R.id.rb_dash:
+                setupDashIndicator();
+                break;
+            case R.id.rb_round_rect:
+                setupRoundRectIndicator();
+                break;
+            case R.id.rb_tmall:
+                setupTMallIndicator();
+                break;
+        }
+    }
+
+    private void setupTMallIndicator() {
         mViewPager
                 .setIndicatorStyle(IndicatorStyle.DASH)
                 .setIndicatorGap(0)
-                .setIndicatorSlideMode(IndicatorSlideMode.SMOOTH)
-                .setIndicatorColor(getColor(R.color.white_alpha_75), getColor(R.color.white))
-                .setIndicatorWidth(getResources().getDimensionPixelOffset(R.dimen.dp_12), getResources().getDimensionPixelOffset(R.dimen.dp_12))
-                .setIndicatorHeight(BannerUtils.dp2px(1.5f))
+                .setIndicatorSlideMode(mSlideMode)
+                .setIndicatorColor(getColor(R.color.red_normal_color), getColor(R.color.red_checked_color))
+                .setIndicatorWidth(getResources().getDimensionPixelOffset(R.dimen.dp_15))
+                .setIndicatorHeight(BannerUtils.dp2px(3f))
                 .create(getMDrawableList());
     }
 
     private void setupRoundRectIndicator() {
+        int checkedWidth = getResources().getDimensionPixelOffset(R.dimen.dp_10);
+        int normalWidth = getNormalWidth();
         mViewPager.setIndicatorStyle(IndicatorStyle.ROUND_RECT)
                 .setIndicatorGravity(IndicatorGravity.CENTER)
                 .setIndicatorGap(BannerUtils.dp2px(4))
                 .setPageMargin(0)
-                .setIndicatorSlideMode(IndicatorSlideMode.NORMAL)
+                .setIndicatorSlideMode(mSlideMode)
                 .setIndicatorHeight(getResources().getDimensionPixelOffset(R.dimen.dp_4))
                 .setOnPageClickListener(position -> ToastUtils.show("position:" + position))
                 .setIndicatorColor(getColor(R.color.red_normal_color), getColor(R.color.red_checked_color))
-                .setIndicatorWidth(getResources().getDimensionPixelOffset(R.dimen.dp_4), getResources().getDimensionPixelOffset(R.dimen.dp_10)).create(getMDrawableList());
+                .setIndicatorWidth(normalWidth, checkedWidth).create(getMDrawableList());
     }
 
     private void setupCircleIndicator() {
         mViewPager.setIndicatorStyle(IndicatorStyle.CIRCLE)
-                .setIndicatorSlideMode(IndicatorSlideMode.SMOOTH)
+                .setIndicatorSlideMode(mSlideMode)
                 .setIndicatorGravity(IndicatorGravity.CENTER)
                 .setIndicatorGap(getResources().getDimensionPixelOffset(R.dimen.dp_6))
+                .setIndicatorHeight(getResources().getDimensionPixelOffset(R.dimen.dp_4))
                 .setPageMargin(0)
                 .setOnPageClickListener(position -> ToastUtils.show("position:" + position))
                 .setIndicatorColor(getColor(R.color.red_normal_color), getColor(R.color.red_checked_color))
-                .setIndicatorRadius(getResources().getDimensionPixelOffset(R.dimen.dp_4), getResources().getDimensionPixelOffset(R.dimen.dp_5)).create(getMDrawableList());
+                .setIndicatorRadius(getResources().getDimensionPixelOffset(R.dimen.dp_4)).create(getMDrawableList());
     }
 
     private void setupDashIndicator() {
+        int checkedWidth = getResources().getDimensionPixelOffset(R.dimen.dp_10);
+        int normalWidth = getNormalWidth();
         mViewPager.setIndicatorStyle(IndicatorStyle.DASH)
                 .setIndicatorHeight(getResources().getDimensionPixelOffset(R.dimen.dp_3))
                 .setIndicatorGravity(IndicatorGravity.CENTER)
-                .setIndicatorSlideMode(IndicatorSlideMode.NORMAL)
+                .setIndicatorSlideMode(mSlideMode)
                 .setIndicatorGap(getResources().getDimensionPixelOffset(R.dimen.dp_3))
                 .setPageMargin(0)
-                .setIndicatorWidth(getResources().getDimensionPixelOffset(R.dimen.dp_3), getResources().getDimensionPixelOffset(R.dimen.dp_10))
+                .setIndicatorWidth(normalWidth, checkedWidth)
                 .setIndicatorColor(Color.parseColor("#888888"),
                         Color.parseColor("#118EEA")).create(getMDrawableList());
     }
+
+    private int getNormalWidth() {
+        if (mSlideMode == IndicatorSlideMode.SMOOTH || mSlideMode == IndicatorSlideMode.WORM) {
+            return getResources().getDimensionPixelOffset(R.dimen.dp_10);
+        } else {
+            return getResources().getDimensionPixelOffset(R.dimen.dp_4);
+        }
+    }
 }

+ 2 - 2
app/src/main/java/com/example/zhpan/circleviewpager/fragment/PageFragment.java

@@ -55,8 +55,10 @@ public class PageFragment extends BaseFragment {
         mRadioGroupPageStyle = view.findViewById(R.id.rg_page_style);
         radioButton = view.findViewById(R.id.rb_multi_page);
         mViewPager
+                .setIndicatorSlideMode(IndicatorSlideMode.NORMAL)
                 .setHolderCreator(() -> new ImageResourceViewHolder(getResources().getDimensionPixelOffset(R.dimen.dp_5)))
                 .setIndicatorColor(getColor(R.color.red_normal_color), getColor(R.color.red_checked_color))
+                .setIndicatorRadius(getResources().getDimensionPixelOffset(R.dimen.dp_4),getResources().getDimensionPixelOffset(R.dimen.dp_5))
                 .setOnPageClickListener(position -> ToastUtils.show("position:" + position))
                 .setInterval(5000);
         initRadioGroup();
@@ -90,7 +92,6 @@ public class PageFragment extends BaseFragment {
 
     private void setupBanner(@APageStyle int pageStyle) {
         mViewPager
-                .setIndicatorSlideMode(IndicatorSlideMode.WORM)
                 .setPageMargin(getResources().getDimensionPixelOffset(R.dimen.dp_10))
                 .setRevealWidth(getResources().getDimensionPixelOffset(R.dimen.dp_10))
                 .setPageStyle(pageStyle)
@@ -100,7 +101,6 @@ public class PageFragment extends BaseFragment {
     //  仿QQ音乐的Banner
     private void setNetEaseMusicStyle() {
         mViewPager
-                .setIndicatorSlideMode(IndicatorSlideMode.NORMAL)
                 .setPageMargin(getResources().getDimensionPixelOffset(R.dimen.dp_15))
                 .setRevealWidth(BannerUtils.dp2px(0))
                 .setPageStyle(PageStyle.MULTI_PAGE)

+ 6 - 6
app/src/main/res/layout/activity_main.xml

@@ -32,29 +32,29 @@
                 android:textColor="@drawable/text_color_selector" />
 
             <RadioButton
-                android:id="@+id/rb_find"
+                android:id="@+id/rb_add"
                 android:layout_width="0dp"
                 android:layout_height="match_parent"
                 android:layout_gravity="bottom"
                 android:layout_weight="1"
                 android:button="@null"
-                android:drawableTop="@drawable/tab2_selector"
+                android:drawableTop="@drawable/tab3_selector"
                 android:gravity="center_horizontal|bottom"
                 android:paddingBottom="@dimen/dp_5"
-                android:text="@string/tab2"
+                android:text="@string/tab3"
                 android:textColor="@drawable/text_color_selector" />
 
             <RadioButton
-                android:id="@+id/rb_add"
+                android:id="@+id/rb_find"
                 android:layout_width="0dp"
                 android:layout_height="match_parent"
                 android:layout_gravity="bottom"
                 android:layout_weight="1"
                 android:button="@null"
-                android:drawableTop="@drawable/tab3_selector"
+                android:drawableTop="@drawable/tab2_selector"
                 android:gravity="center_horizontal|bottom"
                 android:paddingBottom="@dimen/dp_5"
-                android:text="@string/tab3"
+                android:text="@string/tab2"
                 android:textColor="@drawable/text_color_selector" />
 
             <RadioButton

+ 129 - 58
app/src/main/res/layout/fragment_indicator.xml

@@ -13,62 +13,133 @@
         app:bvp_indicator_visibility="visible"
         app:bvp_round_corner="@dimen/dp_8" />
 
-    <TextView
-        android:id="@+id/tv_page_style"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="@dimen/dp_10"
-        android:layout_marginTop="@dimen/dp_10"
-        android:text="@string/text_indicator_style"
-        android:textColor="#000000"
-        android:textSize="@dimen/sp_18"
-        android:textStyle="bold" />
-
-    <RadioGroup
-        android:id="@+id/rg_indicator_style"
+    <androidx.core.widget.NestedScrollView
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical"
-        android:padding="@dimen/dp_15">
-
-        <RadioButton
-            android:id="@+id/rb_circle"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="15dp"
-            android:layout_marginBottom="@dimen/dp_10"
-            android:text="Circle"
-            android:textSize="@dimen/sp_16" />
-
-        <RadioButton
-            android:id="@+id/rb_dash"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="15dp"
-            android:layout_marginBottom="@dimen/dp_10"
-            android:text="Dash"
-            android:textSize="@dimen/sp_16" />
-
-        <RadioButton
-            android:id="@+id/rb_round_rect"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="15dp"
-            android:layout_marginBottom="@dimen/dp_10"
-            android:text="ROUND_RECT"
-            android:textSize="@dimen/sp_16" />
-
-        <RadioButton
-            android:id="@+id/rb_tmall"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="15dp"
-            android:layout_marginBottom="@dimen/dp_10"
-            android:text="Tmall Indicator Style"
-            android:textSize="@dimen/sp_16" />
-
-
-    </RadioGroup>
-
-
-</LinearLayout>
+        android:layout_height="match_parent">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="vertical">
+
+            <TextView
+                android:id="@+id/tv_page_style"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="@dimen/dp_10"
+                android:layout_marginTop="@dimen/dp_10"
+                android:text="@string/text_indicator_style"
+                android:textColor="#000000"
+                android:textSize="@dimen/sp_18"
+                android:textStyle="bold" />
+
+            <RadioGroup
+                android:id="@+id/rg_indicator_style"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical"
+                android:padding="@dimen/dp_15">
+
+                <RadioButton
+                    android:id="@+id/rb_circle"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginEnd="15dp"
+                    android:layout_marginBottom="@dimen/dp_10"
+                    android:text="Circle"
+                    android:textSize="@dimen/sp_16" />
+
+                <RadioButton
+                    android:id="@+id/rb_dash"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginEnd="15dp"
+                    android:layout_marginBottom="@dimen/dp_10"
+                    android:text="Dash"
+                    android:textSize="@dimen/sp_16" />
+
+                <RadioButton
+                    android:id="@+id/rb_round_rect"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginEnd="15dp"
+                    android:layout_marginBottom="@dimen/dp_10"
+                    android:text="ROUND_RECT"
+                    android:textSize="@dimen/sp_16" />
+
+                <RadioButton
+                    android:id="@+id/rb_tmall"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginEnd="15dp"
+                    android:layout_marginBottom="@dimen/dp_10"
+                    android:text="Tmall Indicator Style"
+                    android:textSize="@dimen/sp_16" />
+
+
+            </RadioGroup>
+
+            <TextView
+                android:id="@+id/tv_slide_mode"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="@dimen/dp_10"
+                android:layout_marginTop="@dimen/dp_10"
+                android:text="@string/text_slide_mode"
+                android:textColor="#000000"
+                android:textSize="@dimen/sp_18"
+                android:textStyle="bold" />
+
+            <RadioGroup
+                android:id="@+id/rg_slide_mode"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical"
+                android:padding="@dimen/dp_15">
+
+                <RadioButton
+                    android:id="@+id/rb_worm"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginEnd="15dp"
+                    android:checked="true"
+                    android:layout_marginBottom="@dimen/dp_10"
+                    android:text="WORM"
+                    android:textSize="@dimen/sp_16" />
+
+
+                <RadioButton
+                    android:id="@+id/rb_smooth"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginEnd="15dp"
+                    android:layout_marginBottom="@dimen/dp_10"
+                    android:text="SMOOTH"
+                    android:textSize="@dimen/sp_16" />
+
+                <RadioButton
+                    android:id="@+id/rb_normal"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginEnd="15dp"
+                    android:layout_marginBottom="@dimen/dp_10"
+                    android:text="NORMAL"
+                    android:textSize="@dimen/sp_16" />
+
+                <RadioButton
+                    android:id="@+id/rb_scale"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginEnd="15dp"
+                    android:visibility="gone"
+                    android:layout_marginBottom="@dimen/dp_10"
+                    android:text="SCALE"
+                    android:textSize="@dimen/sp_16" />
+
+            </RadioGroup>
+
+        </LinearLayout>
+    </androidx.core.widget.NestedScrollView>
+
+</LinearLayout>
+

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -13,4 +13,5 @@
     <string name="text_page_style">Page Style:</string>
     <string name="text_indicator_style">Indicator Style:</string>
     <string name="custom_style">Custom Style</string>
+    <string name="text_slide_mode">Indicator Slide Mode</string>
 </resources>

+ 1 - 1
bannerview/src/main/java/com/zhpan/bannerview/annotation/AIndicatorSlideMode.java

@@ -19,6 +19,6 @@ import static com.zhpan.bannerview.constants.IndicatorSlideMode.WORM;
  */
 @IntDef({NORMAL, SMOOTH,WORM})
 @Retention(RetentionPolicy.SOURCE)
-@Target(ElementType.PARAMETER)
+@Target({ElementType.PARAMETER,ElementType.FIELD})
 public @interface AIndicatorSlideMode {
 }

+ 3 - 6
bannerview/src/main/java/com/zhpan/bannerview/indicator/drawer/CircleDrawer.java

@@ -45,12 +45,12 @@ public class CircleDrawer extends BaseDrawer {
     @Override
     public void onDraw(Canvas canvas) {
         if (mIndicatorOptions.getPageSize() > 1) {
-            drawableNormalCircle(canvas);
+            drawableNormal(canvas);
             drawSlider(canvas);
         }
     }
 
-    private void drawableNormalCircle(Canvas canvas) {
+    private void drawableNormal(Canvas canvas) {
         float normalIndicatorWidth = mIndicatorOptions.getNormalIndicatorWidth();
         mPaint.setColor(mIndicatorOptions.getNormalColor());
         for (int i = 0; i < mIndicatorOptions.getPageSize(); i++) {
@@ -68,11 +68,8 @@ public class CircleDrawer extends BaseDrawer {
                 drawCircleSlider(canvas);
                 break;
             case WORM:
-                drawWormSlider(canvas, mIndicatorOptions.getSliderHeight() * 2);
+                drawWormSlider(canvas, mIndicatorOptions.getNormalIndicatorWidth());
                 break;
-//            case THIN_WORM:
-//                drawWormSlider(canvas, mIndicatorOptions.getSliderHeight());
-//                break;
         }
     }
 

+ 13 - 5
bannerview/src/main/java/com/zhpan/bannerview/indicator/drawer/DashDrawer.java

@@ -25,7 +25,7 @@ public class DashDrawer extends BaseDrawer {
     public MeasureResult onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
         maxWidth = Math.max(mIndicatorOptions.getNormalIndicatorWidth(), mIndicatorOptions.getCheckedIndicatorWidth());
         minWidth = Math.min(mIndicatorOptions.getNormalIndicatorWidth(), mIndicatorOptions.getCheckedIndicatorWidth());
-        mMeasureResult.setMeasureResult(getMeasureWidth(), (int)mIndicatorOptions.getSliderHeight());
+        mMeasureResult.setMeasureResult(getMeasureWidth(), (int) mIndicatorOptions.getSliderHeight());
         return mMeasureResult;
     }
 
@@ -44,10 +44,18 @@ public class DashDrawer extends BaseDrawer {
         int pageSize = mIndicatorOptions.getPageSize();
         if (pageSize > 1) {
             for (int i = 0; i < pageSize; i++) {
-                if (mIndicatorOptions.getSlideMode() == IndicatorSlideMode.SMOOTH) {
-                    smoothSlide(canvas, i);
-                } else {
-                    normalSlide(canvas, i);
+                switch (mIndicatorOptions.getSlideMode()) {
+                    case IndicatorSlideMode.NORMAL:
+                        normalSlide(canvas, i);
+                        break;
+                    case IndicatorSlideMode.SMOOTH:
+                    case IndicatorSlideMode.WORM:
+                        if (mIndicatorOptions.getNormalIndicatorWidth() == mIndicatorOptions.getCheckedIndicatorWidth()) {
+                            smoothSlide(canvas, i);
+                        } else {
+                            normalSlide(canvas, i);
+                        }
+                        break;
                 }
             }
         }

+ 13 - 6
bannerview/src/main/java/com/zhpan/bannerview/indicator/drawer/RoundRectDrawer.java

@@ -45,10 +45,18 @@ public class RoundRectDrawer extends BaseDrawer {
         int pageSize = mIndicatorOptions.getPageSize();
         if (pageSize > 1) {
             for (int i = 0; i < pageSize; i++) {
-                if (mIndicatorOptions.getSlideMode() == IndicatorSlideMode.SMOOTH) {
-                    smoothSlide(canvas, i);
-                } else {
-                    normalSlide(canvas, i);
+                switch (mIndicatorOptions.getSlideMode()) {
+                    case IndicatorSlideMode.NORMAL:
+                        normalSlide(canvas, i);
+                        break;
+                    case IndicatorSlideMode.SMOOTH:
+                    case IndicatorSlideMode.WORM:
+                        if (mIndicatorOptions.getNormalIndicatorWidth() == mIndicatorOptions.getCheckedIndicatorWidth()) {
+                            smoothSlide(canvas, i);
+                        } else {
+                            normalSlide(canvas, i);
+                        }
+                        break;
                 }
             }
         }
@@ -68,7 +76,6 @@ public class RoundRectDrawer extends BaseDrawer {
             canvas.drawRoundRect(rectF, sliderHeight, sliderHeight, mPaint);
             drawSliderStyle(canvas);
         } else {
-
             if (i < currentPosition) {
                 mPaint.setColor(normalColor);
                 float left = i * minWidth + i * indicatorGap;
@@ -103,7 +110,7 @@ public class RoundRectDrawer extends BaseDrawer {
         float indicatorGap = mIndicatorOptions.getIndicatorGap();
         float sliderHeight = mIndicatorOptions.getSliderHeight();
         float left = currentPosition * (maxWidth) + currentPosition * +indicatorGap + (maxWidth + indicatorGap) * mIndicatorOptions.getSlideProgress();
-        RectF rectF = new RectF(left, 0, left + minWidth, sliderHeight);
+        RectF rectF = new RectF(left, 0, left + maxWidth, sliderHeight);
         canvas.drawRoundRect(rectF, sliderHeight, sliderHeight, mPaint);
 //        canvas.drawRect(left, 0, left + maxWidth, mIndicatorOptions.getSliderHeight(), mPaint);
     }