diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/RoundConstraintLayout.java b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/RoundConstraintLayout.java
index dbb2abb436..dbe0b2dbf5 100644
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/RoundConstraintLayout.java
+++ b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/RoundConstraintLayout.java
@@ -6,6 +6,7 @@ import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;
+import android.view.GestureDetector;
import android.view.MotionEvent;
import androidx.constraintlayout.widget.ConstraintLayout;
@@ -18,7 +19,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
* desc :
* version: 1.0
*/
-public class RoundConstraintLayout extends ConstraintLayout {
+public class RoundConstraintLayout extends ConstraintLayout implements GestureDetector.OnGestureListener {
private float roundLayoutRadius = 14f;
private Path roundPath;
@@ -30,6 +31,8 @@ public class RoundConstraintLayout extends ConstraintLayout {
private IScrollListener mScrollListener;
+ private GestureDetector mDetector;
+
public RoundConstraintLayout(Context context) {
this(context, null);
}
@@ -52,6 +55,7 @@ public class RoundConstraintLayout extends ConstraintLayout {
setWillNotDraw(false);//如果你继承的是ViewGroup,注意此行,否则draw方法是不会回调的;
roundPath = new Path();
rectF = new RectF();
+ mDetector = new GestureDetector(getContext(), this);
}
private void setRoundPath() {
@@ -92,25 +96,13 @@ public class RoundConstraintLayout extends ConstraintLayout {
int x = (int) ev.getX();
int y = (int) ev.getY();
switch (ev.getAction()) {
- case MotionEvent.ACTION_DOWN:
- intercepted = false;
- break;
case MotionEvent.ACTION_MOVE:
int deltaX = x - mLastXIntercept;
int deltaY = y - mLastYIntercept;
if (Math.abs(deltaX) > Math.abs(deltaY)) {
intercepted = true;
- if (mScrollListener != null) {
- // 向左滑动,则向右滚动
- mScrollListener.onScroll(x - mLastXIntercept >= 0);
- }
- } else {
- intercepted = false;
}
break;
- case MotionEvent.ACTION_UP:
- intercepted = false;
- break;
default:
break;
}
@@ -119,11 +111,53 @@ public class RoundConstraintLayout extends ConstraintLayout {
return intercepted;
}
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ if (mDetector != null) {
+ return mDetector.onTouchEvent(event);
+ } else {
+ return super.onTouchEvent(event);
+ }
+ }
+
+ @Override
+ public boolean onDown(MotionEvent e) {
+ return true;
+ }
+
+ @Override
+ public void onShowPress(MotionEvent e) {
+ }
+
+ @Override
+ public boolean onSingleTapUp(MotionEvent e) {
+ return true;
+ }
+
+ @Override
+ public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
+ return true;
+ }
+
+ @Override
+ public void onLongPress(MotionEvent e) {
+ }
+
+ @Override
+ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
+ if (e2 != null) {
+ float deltaX = e2.getX() - (e1 != null ? e1.getX() : 0f);
+ float deltaY = e2.getY() - (e1 != null ? e1.getY() : 0f);
+ if (Math.abs(deltaX) > Math.abs(deltaY)) {
+ if (mScrollListener != null) {
+ mScrollListener.onScroll(velocityX < 0);
+ }
+ }
+ }
+ return true;
+ }
+
public interface IScrollListener {
- /**
- *
- * @param is2Left : 画面向左滚动
- */
- void onScroll(boolean is2Left);
+ void onScroll(boolean isNextPage);
}
}
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/IndicatorView.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/IndicatorView.kt
deleted file mode 100644
index 6009af3076..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/IndicatorView.kt
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.mogo.eagle.core.widget.indicator
-
-import android.content.Context
-import android.graphics.Canvas
-import android.util.AttributeSet
-import com.mogo.eagle.core.widget.indicator.annotation.AIndicatorOrientation
-
-import com.mogo.eagle.core.widget.indicator.base.BaseIndicatorView
-import com.mogo.eagle.core.widget.indicator.drawer.DrawerProxy
-import com.mogo.eagle.core.widget.indicator.enums.IndicatorOrientation
-import com.mogo.eagle.core.widget.indicator.option.AttrsController
-import com.mogo.eagle.core.widget.indicator.option.IndicatorOptions
-
-class IndicatorView @JvmOverloads constructor(
- context: Context,
- attrs: AttributeSet? = null,
- defStyleAttr: Int = 0
-) : BaseIndicatorView(context, attrs, defStyleAttr) {
-
- private var mDrawerProxy: DrawerProxy
-
- init {
- AttrsController.initAttrs(context, attrs, mIndicatorOptions)
- mDrawerProxy = DrawerProxy(mIndicatorOptions)
- }
-
- override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
- super.onLayout(changed, left, top, right, bottom)
- mDrawerProxy.onLayout(changed, left, top, right, bottom)
- }
-
- override fun onMeasure(
- widthMeasureSpec: Int,
- heightMeasureSpec: Int
- ) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec)
- val measureResult = mDrawerProxy.onMeasure(widthMeasureSpec, heightMeasureSpec)
- setMeasuredDimension(measureResult.measureWidth, measureResult.measureHeight)
- }
-
- override fun onDraw(canvas: Canvas) {
- super.onDraw(canvas)
- rotateCanvas(canvas)
- mDrawerProxy.onDraw(canvas)
- }
-
- override fun setIndicatorOptions(options: IndicatorOptions) {
- super.setIndicatorOptions(options)
- mDrawerProxy.setIndicatorOptions(options)
- }
-
- override fun notifyDataChanged(itemCount:Int) {
- mDrawerProxy = DrawerProxy(mIndicatorOptions)
- super.notifyDataChanged(itemCount)
- }
-
- private fun rotateCanvas(canvas: Canvas) {
- if (mIndicatorOptions.orientation == IndicatorOrientation.INDICATOR_VERTICAL) {
- canvas.rotate(90f, width / 2f, width / 2f)
- } else if (mIndicatorOptions.orientation == IndicatorOrientation.INDICATOR_RTL) {
- canvas.rotate(180f, width / 2f, height / 2f)
- }
- }
-
- fun setOrientation(@AIndicatorOrientation orientation: Int) {
- mIndicatorOptions.orientation = orientation;
- }
-}
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/annotation/AIndicatorOrientation.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/annotation/AIndicatorOrientation.kt
deleted file mode 100644
index 4cacd1e7f5..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/annotation/AIndicatorOrientation.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.annotation
-
-import androidx.annotation.IntDef
-import com.mogo.eagle.core.widget.indicator.enums.IndicatorOrientation
-
-/**
- *
- * @author zhangpan
- * @date 2021/1/21
- */
-@IntDef(
- IndicatorOrientation.INDICATOR_HORIZONTAL, IndicatorOrientation.INDICATOR_VERTICAL,
- IndicatorOrientation.INDICATOR_RTL
-)
-@kotlin.annotation.Retention(AnnotationRetention.SOURCE)
-@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FIELD)
-annotation class AIndicatorOrientation()
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/annotation/AIndicatorSlideMode.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/annotation/AIndicatorSlideMode.kt
deleted file mode 100644
index 6d710c5035..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/annotation/AIndicatorSlideMode.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.annotation
-
-import androidx.annotation.IntDef
-import com.mogo.eagle.core.widget.indicator.enums.IndicatorSlideMode.Companion.COLOR
-import com.mogo.eagle.core.widget.indicator.enums.IndicatorSlideMode.Companion.NORMAL
-import com.mogo.eagle.core.widget.indicator.enums.IndicatorSlideMode.Companion.SCALE
-import com.mogo.eagle.core.widget.indicator.enums.IndicatorSlideMode.Companion.SMOOTH
-import com.mogo.eagle.core.widget.indicator.enums.IndicatorSlideMode.Companion.WORM
-
-/**
- *
- * Created by zhangpan on 2019-10-18.
- * Description:
-
*
- */
-@IntDef(NORMAL, SMOOTH, WORM, COLOR, SCALE)
-@kotlin.annotation.Retention(AnnotationRetention.SOURCE)
-@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FIELD)
-annotation class AIndicatorSlideMode
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/annotation/AIndicatorStyle.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/annotation/AIndicatorStyle.kt
deleted file mode 100644
index 052e80baa1..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/annotation/AIndicatorStyle.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.annotation
-
-import androidx.annotation.IntDef
-import com.mogo.eagle.core.widget.indicator.enums.IndicatorStyle
-
-/**
- *
- * Created by zhangpan on 2019-10-18.
- * Description:
-
*
- */
-@IntDef(IndicatorStyle.CIRCLE, IndicatorStyle.DASH, IndicatorStyle.ROUND_RECT)
-@kotlin.annotation.Retention(AnnotationRetention.SOURCE)
-@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FIELD)
-annotation class AIndicatorStyle
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/base/BaseIndicatorView.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/base/BaseIndicatorView.kt
deleted file mode 100644
index d8d0687270..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/base/BaseIndicatorView.kt
+++ /dev/null
@@ -1,204 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.base
-
-import android.content.Context
-import android.util.AttributeSet
-import android.view.View
-
-import androidx.annotation.ColorInt
-import androidx.recyclerview.widget.RecyclerView
-
-import com.mogo.eagle.core.widget.indicator.annotation.AIndicatorSlideMode
-import com.mogo.eagle.core.widget.indicator.annotation.AIndicatorStyle
-import com.mogo.eagle.core.widget.indicator.enums.IndicatorSlideMode
-import com.mogo.eagle.core.widget.indicator.option.IndicatorOptions
-
-/**
- *
- * Created by zhangpan on 2019-09-04.
- * Description:IndicatorView基类,处理了页面滑动。
- *
- */
-@Suppress("UNUSED")
-open class BaseIndicatorView constructor(
- context: Context,
- attrs: AttributeSet?,
- defStyleAttr: Int
-) : View(context, attrs, defStyleAttr), IIndicator {
-
- var mIndicatorOptions: IndicatorOptions
-
- private var recyclerView: RecyclerView? = null
-
- init {
- mIndicatorOptions = IndicatorOptions()
- }
-
- fun setPageSize(pageSize: Int): BaseIndicatorView {
- mIndicatorOptions.pageSize = pageSize
- return this
- }
-
- // 页面选定
- fun onPageSelected(position: Int) {
- if (getSlideMode() == IndicatorSlideMode.NORMAL) {
- setCurrentPosition(position)
- setSlideProgress(0f)
- invalidate()
- }
- }
-
- // 滚动距离
- fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
- if (getSlideMode() != IndicatorSlideMode.NORMAL && getPageSize() > 1) {
- scrollSlider(position, positionOffset)
- invalidate()
- }
- }
-
- private fun scrollSlider(position: Int, positionOffset: Float) {
- if (mIndicatorOptions.slideMode == IndicatorSlideMode.SCALE
- || mIndicatorOptions.slideMode == IndicatorSlideMode.COLOR) {
- setCurrentPosition(position)
- setSlideProgress(positionOffset)
- } else {
- if (position % getPageSize() == getPageSize() - 1) { // 最后一个页面与第一个页面
- if (positionOffset < 0.5) {
- setCurrentPosition(position)
- setSlideProgress(0f)
- } else {
- setCurrentPosition(0)
- setSlideProgress(0f)
- }
- } else { // 中间页面
- setCurrentPosition(position)
- setSlideProgress(positionOffset)
- }
- }
- }
-
- override fun notifyDataChanged(itemCount: Int) {
- setPageSize(itemCount)
- requestLayout()
- invalidate()
- }
-
- private fun setupViewPager() {
-
- }
-
- fun getNormalSlideWidth(): Float {
- return mIndicatorOptions.normalSliderWidth
- }
-
- fun setNormalSlideWidth(normalSliderWidth: Float) {
- mIndicatorOptions.normalSliderWidth = normalSliderWidth
- }
-
- fun getCheckedSlideWidth(): Float {
- return mIndicatorOptions.checkedSliderWidth
- }
-
- fun setCheckedSlideWidth(checkedSliderWidth: Float) {
- mIndicatorOptions.checkedSliderWidth = checkedSliderWidth
- }
-
- val checkedSliderWidth: Float
- get() = mIndicatorOptions.checkedSliderWidth
-
- fun setCurrentPosition(currentPosition: Int) {
- mIndicatorOptions.currentPosition = currentPosition
- }
-
- fun getCurrentPosition(): Int {
- return mIndicatorOptions.currentPosition
- }
-
- fun getIndicatorGap(indicatorGap: Float) {
- mIndicatorOptions.sliderGap = indicatorGap
- }
-
- fun setIndicatorGap(indicatorGap: Float) {
- mIndicatorOptions.sliderGap = indicatorGap
- }
-
- fun setCheckedColor(@ColorInt normalColor: Int) {
- mIndicatorOptions.checkedSliderColor = normalColor
- }
-
- fun getCheckedColor(): Int {
- return mIndicatorOptions.checkedSliderColor
- }
-
- fun setNormalColor(@ColorInt normalColor: Int) {
- mIndicatorOptions.normalSliderColor = normalColor
- }
-
- fun getSlideProgress(): Float {
- return mIndicatorOptions.slideProgress
- }
-
- fun setSlideProgress(slideProgress: Float) {
- mIndicatorOptions.slideProgress = slideProgress
- }
-
- fun getPageSize(): Int {
- return mIndicatorOptions.pageSize
- }
-
- fun setSliderColor(
- @ColorInt normalColor: Int,
- @ColorInt selectedColor: Int,
- @ColorInt selectedEndColor: Int
- ): BaseIndicatorView {
- mIndicatorOptions.setSliderColor(normalColor, selectedColor,selectedEndColor)
- return this
- }
-
- fun setSliderWidth(sliderWidth: Float): BaseIndicatorView {
- mIndicatorOptions.setSliderWidth(sliderWidth)
- return this
- }
-
- fun setSliderWidth(
- normalSliderWidth: Float,
- selectedSliderWidth: Float
- ): BaseIndicatorView {
- mIndicatorOptions.setSliderWidth(normalSliderWidth, selectedSliderWidth)
- return this
- }
-
- fun setSliderGap(sliderGap: Float): BaseIndicatorView {
- mIndicatorOptions.sliderGap = sliderGap
- return this
- }
-
- fun getSlideMode(): Int {
- return mIndicatorOptions.slideMode
- }
-
- fun setSlideMode(@AIndicatorSlideMode slideMode: Int): BaseIndicatorView {
- mIndicatorOptions.slideMode = slideMode
- return this
- }
-
- fun setIndicatorStyle(@AIndicatorStyle indicatorStyle: Int): BaseIndicatorView {
- mIndicatorOptions.indicatorStyle = indicatorStyle
- return this
- }
-
- fun setSliderHeight(sliderHeight: Float): BaseIndicatorView {
- mIndicatorOptions.sliderHeight = sliderHeight
- return this
- }
-
- fun showIndicatorWhenOneItem(showIndicatorWhenOneItem: Boolean) {
- mIndicatorOptions.showIndicatorOneItem = showIndicatorWhenOneItem
- }
-
- fun onPageScrollStateChanged(state: Int) {
- }
-
- override fun setIndicatorOptions(options: IndicatorOptions) {
- mIndicatorOptions = options
- }
-}
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/base/IIndicator.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/base/IIndicator.kt
deleted file mode 100644
index dc5aa7bf1c..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/base/IIndicator.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.base
-
-
-import com.mogo.eagle.core.widget.indicator.option.IndicatorOptions
-
-/**
- *
- * Created by zhangpan on 2019-09-02.
- * Description:
-
*
- */
-interface IIndicator {
-
- fun notifyDataChanged(itemCount:Int)
-
- fun setIndicatorOptions(options: IndicatorOptions)
-}
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/BaseDrawer.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/BaseDrawer.kt
deleted file mode 100644
index 16ab894839..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/BaseDrawer.kt
+++ /dev/null
@@ -1,94 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.drawer
-
-import android.animation.ArgbEvaluator
-import android.graphics.Paint
-import com.mogo.eagle.core.widget.indicator.enums.IndicatorOrientation
-import com.mogo.eagle.core.widget.indicator.enums.IndicatorSlideMode
-
-import com.mogo.eagle.core.widget.indicator.option.IndicatorOptions
-
-/**
- *
- * Created by zhpan on 2019/11/23.
- * Description:
-
*
- */
-abstract class BaseDrawer internal constructor(internal var mIndicatorOptions: IndicatorOptions) :
- IDrawer {
-
- private val mMeasureResult: MeasureResult
- internal var maxWidth: Float = 0.toFloat()
- internal var minWidth: Float = 0.toFloat()
- internal var mPaint: Paint = Paint()
- internal var argbEvaluator: ArgbEvaluator? = null
-
- companion object {
- const val INDICATOR_PADDING_ADDITION = 6
- const val INDICATOR_PADDING = 3
- }
-
- protected val isWidthEquals: Boolean
- get() = mIndicatorOptions.normalSliderWidth == mIndicatorOptions.checkedSliderWidth
-
- init {
- mPaint.isAntiAlias = true
- mMeasureResult = MeasureResult()
- if (mIndicatorOptions.slideMode == IndicatorSlideMode.SCALE
- || mIndicatorOptions.slideMode == IndicatorSlideMode.COLOR
- ) {
- argbEvaluator = ArgbEvaluator()
- }
- }
-
- override fun onMeasure(
- widthMeasureSpec: Int,
- heightMeasureSpec: Int
- ): MeasureResult {
- maxWidth =
- mIndicatorOptions.normalSliderWidth.coerceAtLeast(mIndicatorOptions.checkedSliderWidth)
- minWidth =
- mIndicatorOptions.normalSliderWidth.coerceAtMost(mIndicatorOptions.checkedSliderWidth)
- if (mIndicatorOptions.orientation == IndicatorOrientation.INDICATOR_VERTICAL) {
- mMeasureResult.setMeasureResult(measureHeight(), measureWidth())
- } else {
- mMeasureResult.setMeasureResult(measureWidth(), measureHeight())
- }
- return mMeasureResult
- }
-
- protected open fun measureHeight(): Int {
- return mIndicatorOptions.sliderHeight.toInt() + INDICATOR_PADDING
- }
-
- private fun measureWidth(): Int {
- val pageSize = mIndicatorOptions.pageSize
- val indicatorGap = mIndicatorOptions.sliderGap
- return ((pageSize - 1) * indicatorGap + maxWidth + (pageSize - 1) * minWidth).toInt() + INDICATOR_PADDING_ADDITION
- }
-
- override fun onLayout(
- changed: Boolean,
- left: Int,
- top: Int,
- right: Int,
- bottom: Int
- ) {
- }
-
- inner class MeasureResult {
-
- var measureWidth: Int = 0
- internal set
-
- var measureHeight: Int = 0
- internal set
-
- internal fun setMeasureResult(
- measureWidth: Int,
- measureHeight: Int
- ) {
- this.measureWidth = measureWidth
- this.measureHeight = measureHeight
- }
- }
-}
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/CircleDrawer.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/CircleDrawer.kt
deleted file mode 100644
index f2c6a1ab86..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/CircleDrawer.kt
+++ /dev/null
@@ -1,157 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.drawer
-
-import android.graphics.Canvas
-import android.graphics.RectF
-import com.mogo.eagle.core.widget.indicator.enums.IndicatorSlideMode
-
-import com.mogo.eagle.core.widget.indicator.option.IndicatorOptions
-import com.mogo.eagle.core.widget.indicator.utils.IndicatorUtils
-
-/**
- *
- * Created by zhpan on 2019/11/23.
- * Description: Circle Indicator drawer.
-
*
- */
-class CircleDrawer internal constructor(indicatorOptions: IndicatorOptions) : BaseDrawer(
- indicatorOptions
-) {
-
- private val rectF = RectF()
-
- override fun measureHeight(): Int {
- return maxWidth.toInt() + INDICATOR_PADDING_ADDITION
- }
-
- override fun onDraw(canvas: Canvas) {
- val pageSize = mIndicatorOptions.pageSize
- if (pageSize > 1 || mIndicatorOptions.showIndicatorOneItem && pageSize == 1) {
- drawNormal(canvas)
- drawSlider(canvas)
- }
- }
-
- private fun drawNormal(canvas: Canvas) {
- val normalIndicatorWidth = mIndicatorOptions.normalSliderWidth
- mPaint.color = mIndicatorOptions.normalSliderColor
- for (i in 0 until mIndicatorOptions.pageSize) {
- val coordinateX = IndicatorUtils.getCoordinateX(mIndicatorOptions, maxWidth, i)
- val coordinateY = IndicatorUtils.getCoordinateY(maxWidth)
- drawCircle(canvas, coordinateX, coordinateY, normalIndicatorWidth / 2)
- }
- }
-
- private fun drawSlider(canvas: Canvas) {
- mPaint.color = mIndicatorOptions.checkedSliderColor
- when (mIndicatorOptions.slideMode) {
- IndicatorSlideMode.NORMAL, IndicatorSlideMode.SMOOTH -> drawCircleSlider(canvas)
- IndicatorSlideMode.WORM -> drawWormSlider(canvas)
- IndicatorSlideMode.SCALE -> drawScaleSlider(canvas)
- IndicatorSlideMode.COLOR -> drawColor(canvas)
- }
- }
-
- private fun drawColor(canvas: Canvas) {
- val currentPosition = mIndicatorOptions.currentPosition
- val slideProgress = mIndicatorOptions.slideProgress
- val coordinateX = IndicatorUtils.getCoordinateX(mIndicatorOptions, maxWidth, currentPosition)
- val coordinateY = IndicatorUtils.getCoordinateY(maxWidth)
- var evaluate = argbEvaluator?.evaluate(
- slideProgress, mIndicatorOptions.checkedSliderColor, mIndicatorOptions.normalSliderColor
- )
- mPaint.color = (evaluate as Int)
- drawCircle(canvas, coordinateX, coordinateY, mIndicatorOptions.normalSliderWidth / 2)
-
- // 绘制可循环的ViewPager指示器渐变
- evaluate = argbEvaluator?.evaluate(
- 1 - slideProgress, mIndicatorOptions.checkedSliderColor, mIndicatorOptions.normalSliderColor
- )
- mPaint.color = evaluate as Int
- val nextCoordinateX = if (currentPosition == mIndicatorOptions.pageSize - 1) {
- IndicatorUtils.getCoordinateX(mIndicatorOptions, maxWidth, 0)
- } else {
- coordinateX + mIndicatorOptions.sliderGap + mIndicatorOptions.normalSliderWidth
- }
- drawCircle(canvas, nextCoordinateX, coordinateY, mIndicatorOptions.checkedSliderWidth / 2)
- }
-
- private fun drawScaleSlider(canvas: Canvas) {
- val currentPosition = mIndicatorOptions.currentPosition
- val slideProgress = mIndicatorOptions.slideProgress
- val coordinateX = IndicatorUtils.getCoordinateX(mIndicatorOptions, maxWidth, currentPosition)
- val coordinateY = IndicatorUtils.getCoordinateY(maxWidth)
- if (slideProgress < 1) {
- val evaluate = argbEvaluator?.evaluate(
- slideProgress, mIndicatorOptions.checkedSliderColor, mIndicatorOptions.normalSliderColor
- )
- mPaint.color = (evaluate as Int)
- val radius =
- mIndicatorOptions.checkedSliderWidth / 2 - (mIndicatorOptions.checkedSliderWidth / 2 - mIndicatorOptions.normalSliderWidth / 2) * slideProgress
- drawCircle(canvas, coordinateX, coordinateY, radius)
- }
-
- if (currentPosition == mIndicatorOptions.pageSize - 1) {
- val evaluate = argbEvaluator?.evaluate(
- slideProgress, mIndicatorOptions.normalSliderColor, mIndicatorOptions.checkedSliderColor
- )
- mPaint.color = evaluate as Int
- val nextCoordinateX = maxWidth / 2
- val nextRadius = minWidth / 2 + (maxWidth / 2 - minWidth / 2) * (slideProgress)
- drawCircle(canvas, nextCoordinateX, coordinateY, nextRadius)
- } else {
- if (slideProgress > 0) {
- val evaluate = argbEvaluator?.evaluate(
- slideProgress, mIndicatorOptions.normalSliderColor, mIndicatorOptions.checkedSliderColor
- )
- mPaint.color = evaluate as Int
- val nextCoordinateX =
- coordinateX + mIndicatorOptions.sliderGap + mIndicatorOptions.normalSliderWidth
- val nextRadius =
- mIndicatorOptions.normalSliderWidth / 2 + (mIndicatorOptions.checkedSliderWidth / 2 - mIndicatorOptions.normalSliderWidth / 2) * slideProgress
- drawCircle(canvas, nextCoordinateX, coordinateY, nextRadius)
- }
- }
- }
-
- private fun drawCircleSlider(canvas: Canvas) {
- val currentPosition = mIndicatorOptions.currentPosition
- val startCoordinateX =
- IndicatorUtils.getCoordinateX(mIndicatorOptions, maxWidth, currentPosition)
- val endCoordinateX = IndicatorUtils.getCoordinateX(
- mIndicatorOptions, maxWidth, (currentPosition + 1) % mIndicatorOptions.pageSize
- )
- val coordinateX =
- startCoordinateX + (endCoordinateX - startCoordinateX) * mIndicatorOptions.slideProgress
- val coordinateY = IndicatorUtils.getCoordinateY(maxWidth)
- val radius = mIndicatorOptions.checkedSliderWidth / 2
- drawCircle(canvas, coordinateX, coordinateY, radius)
- }
-
- private fun drawWormSlider(canvas: Canvas) {
- val sliderHeight = mIndicatorOptions.normalSliderWidth
- val slideProgress = mIndicatorOptions.slideProgress
- val currentPosition = mIndicatorOptions.currentPosition
- val distance = mIndicatorOptions.sliderGap + mIndicatorOptions.normalSliderWidth
- val startCoordinateX =
- IndicatorUtils.getCoordinateX(mIndicatorOptions, maxWidth, currentPosition)
- val left = startCoordinateX + (distance * (slideProgress - 0.5f) * 2.0f).coerceAtLeast(
- 0f
- ) - mIndicatorOptions.normalSliderWidth / 2 + INDICATOR_PADDING
- val right = startCoordinateX + (distance * slideProgress * 2f).coerceAtMost(
- distance
- ) + mIndicatorOptions.normalSliderWidth / 2 + INDICATOR_PADDING
- rectF.set(left, INDICATOR_PADDING.toFloat(), right, sliderHeight + INDICATOR_PADDING)
- canvas.drawRoundRect(rectF, sliderHeight, sliderHeight, mPaint)
- }
-
- private fun drawCircle(
- canvas: Canvas,
- coordinateX: Float,
- coordinateY: Float,
- radius: Float
- ) {
- canvas.drawCircle(
- coordinateX + INDICATOR_PADDING, coordinateY + INDICATOR_PADDING, radius, mPaint
- )
- }
-}
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/DashDrawer.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/DashDrawer.kt
deleted file mode 100644
index fc8b46f4c2..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/DashDrawer.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.drawer
-
-import android.graphics.Canvas
-
-import com.mogo.eagle.core.widget.indicator.option.IndicatorOptions
-
-/**
- *
- * Created by zhpan on 2019/11/23.
- * Description: Dash Indicator Drawer.
-
*
- */
-class DashDrawer internal constructor(indicatorOptions: IndicatorOptions) : RectDrawer(
- indicatorOptions
-) {
-
- override fun drawDash(canvas: Canvas) {
- canvas.drawRect(mRectF, mPaint)
- }
-}
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/DrawerFactory.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/DrawerFactory.kt
deleted file mode 100644
index 99e0d7bf09..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/DrawerFactory.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.drawer
-
-import com.mogo.eagle.core.widget.indicator.enums.IndicatorStyle
-import com.mogo.eagle.core.widget.indicator.option.IndicatorOptions
-
-/**
- *
- * Created by zhpan on 2019/11/24.
- * Description: Indicator Drawer Factory.
-
*
- */
-internal object DrawerFactory {
- fun createDrawer(indicatorOptions: IndicatorOptions): IDrawer {
- return when (indicatorOptions.indicatorStyle) {
- IndicatorStyle.DASH -> DashDrawer(indicatorOptions)
- IndicatorStyle.ROUND_RECT -> RoundRectDrawer(indicatorOptions)
- else -> CircleDrawer(indicatorOptions)
- }
- }
-}
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/DrawerProxy.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/DrawerProxy.kt
deleted file mode 100644
index 4e7427258d..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/DrawerProxy.kt
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.drawer
-
-import android.graphics.Canvas
-
-import com.mogo.eagle.core.widget.indicator.option.IndicatorOptions
-
-/**
- *
- * Created by zhpan on 2019/11/23.
- * Description: Indicator Drawer Proxy.
-
*
- */
-class DrawerProxy(indicatorOptions: IndicatorOptions) : IDrawer {
-
- private lateinit var mIDrawer: IDrawer
-
- init {
- init(indicatorOptions)
- }
-
- private fun init(indicatorOptions: IndicatorOptions) {
- mIDrawer = DrawerFactory.createDrawer(indicatorOptions)
- }
-
- override fun onLayout(
- changed: Boolean,
- left: Int,
- top: Int,
- right: Int,
- bottom: Int
- ) {
- }
-
- override fun onMeasure(
- widthMeasureSpec: Int,
- heightMeasureSpec: Int
- ): BaseDrawer.MeasureResult {
- return mIDrawer.onMeasure(widthMeasureSpec, heightMeasureSpec)
- }
-
- override fun onDraw(canvas: Canvas) {
- mIDrawer.onDraw(canvas)
- }
-
- fun setIndicatorOptions(indicatorOptions: IndicatorOptions) {
- init(indicatorOptions)
- }
-}
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/IDrawer.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/IDrawer.kt
deleted file mode 100644
index 7718673884..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/IDrawer.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.drawer
-
-import android.graphics.Canvas
-import com.mogo.eagle.core.widget.indicator.drawer.BaseDrawer
-
-/**
- *
- * Created by zhpan on 2019/11/23.
- * Description:
-
*
- */
-interface IDrawer {
-
- fun onLayout(
- changed: Boolean,
- left: Int,
- top: Int,
- right: Int,
- bottom: Int
- )
-
- fun onMeasure(
- widthMeasureSpec: Int,
- heightMeasureSpec: Int
- ): BaseDrawer.MeasureResult
-
- fun onDraw(canvas: Canvas)
-}
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/RectDrawer.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/RectDrawer.kt
deleted file mode 100644
index 422227bb96..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/RectDrawer.kt
+++ /dev/null
@@ -1,220 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.drawer
-
-import android.graphics.*
-
-import com.mogo.eagle.core.widget.indicator.enums.IndicatorSlideMode
-import com.mogo.eagle.core.widget.indicator.option.IndicatorOptions
-import com.mogo.eagle.core.widget.indicator.utils.IndicatorUtils
-
-/**
- *
- * Created by zhpan on 2020/1/17.
- * Description:
-
*
- */
-open class RectDrawer internal constructor(indicatorOptions: IndicatorOptions) : BaseDrawer(
- indicatorOptions
-) {
- internal var mRectF: RectF = RectF()
-
- override fun onDraw(canvas: Canvas) {
- val pageSize = mIndicatorOptions.pageSize
- if (pageSize > 1 || mIndicatorOptions.showIndicatorOneItem && pageSize == 1) {
- if (isWidthEquals && mIndicatorOptions.slideMode != IndicatorSlideMode.NORMAL) {
- drawUncheckedSlider(canvas, pageSize)
- drawCheckedSlider(canvas)
- } else { // 单独处理normalWidth与checkedWidth不一致的情况
- if (mIndicatorOptions.slideMode == IndicatorSlideMode.SCALE) {
- for (i in 0 until pageSize) {
- drawScaleSlider(canvas, i)
- }
- } else {
- drawInequalitySlider(canvas, pageSize)
- }
- }
- }
- }
-
- private fun drawScaleSlider(
- canvas: Canvas,
- i: Int
- ) {
- val checkedColor = mIndicatorOptions.checkedSliderColor
- val indicatorGap = mIndicatorOptions.sliderGap
- val sliderHeight = mIndicatorOptions.sliderHeight
- val currentPosition = mIndicatorOptions.currentPosition
- val normalWidth = mIndicatorOptions.normalSliderWidth
- val checkedWidth = mIndicatorOptions.checkedSliderWidth
- when {
- i < currentPosition -> {
- mPaint.color = mIndicatorOptions.normalSliderColor
- val left: Float = if (currentPosition == mIndicatorOptions.pageSize - 1) {
- (i * normalWidth + i * indicatorGap) + (checkedWidth - normalWidth) * mIndicatorOptions.slideProgress
- } else {
- (i * normalWidth + i * indicatorGap)
- }
- mRectF.set(left, 0f, left + normalWidth, sliderHeight)
- drawRoundRect(canvas, sliderHeight, sliderHeight,mRectF.width()>checkedWidth/2)
- }
- i == currentPosition -> {
- mPaint.color = checkedColor
- val slideProgress = mIndicatorOptions.slideProgress
- if (currentPosition == mIndicatorOptions.pageSize - 1) {
- val evaluate = argbEvaluator?.evaluate(
- slideProgress, checkedColor, mIndicatorOptions.normalSliderColor
- )
- mPaint.color = (evaluate as Int)
- val right =
- (mIndicatorOptions.pageSize - 1) * (normalWidth + mIndicatorOptions.sliderGap) + checkedWidth
- val left = right - checkedWidth + (checkedWidth - normalWidth) * (slideProgress)
- mRectF.set(left, 0f, right, sliderHeight)
- drawRoundRect(canvas, sliderHeight, sliderHeight,mRectF.width()>checkedWidth/2)
- } else {
- if (slideProgress < 1) {
- val evaluate = argbEvaluator?.evaluate(
- slideProgress, checkedColor, mIndicatorOptions.normalSliderColor
- )
- mPaint.color = (evaluate as Int)
- val left = i * normalWidth + i * indicatorGap
- val right = left + normalWidth + (checkedWidth - normalWidth) * (1 - slideProgress)
- mRectF.set(left, 0f, right, sliderHeight)
- drawRoundRect(canvas, sliderHeight, sliderHeight,mRectF.width()>checkedWidth/2)
- }
- }
-
- if (currentPosition == mIndicatorOptions.pageSize - 1) {
- if (slideProgress > 0) {
- val evaluate = argbEvaluator?.evaluate(
- 1 - slideProgress, checkedColor, mIndicatorOptions.normalSliderColor
- )
- mPaint.color = evaluate as Int
- val left = 0f
- val right = left + normalWidth + (checkedWidth - normalWidth) * slideProgress
-
- mRectF.set(left, 0f, right, sliderHeight)
- drawRoundRect(canvas, sliderHeight, sliderHeight,mRectF.width()>checkedWidth/2)
- }
- } else {
- if (slideProgress > 0) {
- val evaluate = argbEvaluator?.evaluate(
- 1 - slideProgress, checkedColor, mIndicatorOptions.normalSliderColor
- )
- mPaint.color = evaluate as Int
- val right =
- i * normalWidth + i * indicatorGap + normalWidth + (indicatorGap + checkedWidth)
- val left = right - (normalWidth) - (checkedWidth - normalWidth) * (slideProgress)
- mRectF.set(left, 0f, right, sliderHeight)
- drawRoundRect(canvas, sliderHeight, sliderHeight,mRectF.width()>checkedWidth/2)
- }
- }
- }
- else -> {
- if ((currentPosition + 1 != i || mIndicatorOptions.slideProgress == 0f)) { // 避免多余绘制
- mPaint.color = mIndicatorOptions.normalSliderColor
- val left = i * minWidth + i * indicatorGap + (checkedWidth - minWidth)
- mRectF.set(left, 0f, left + minWidth, sliderHeight)
- drawRoundRect(canvas, sliderHeight, sliderHeight,false)
- }
- }
- }
- }
-
- private fun drawUncheckedSlider(
- canvas: Canvas,
- pageSize: Int
- ) {
- for (i in 0 until pageSize) {
- mPaint.color = mIndicatorOptions.normalSliderColor
- val left = i * maxWidth + i * +mIndicatorOptions.sliderGap + (maxWidth - minWidth)
- mRectF.set(left, 0f, left + minWidth, mIndicatorOptions.sliderHeight)
- drawRoundRect(canvas, mIndicatorOptions.sliderHeight, mIndicatorOptions.sliderHeight,false)
- }
- }
-
- private fun drawInequalitySlider(
- canvas: Canvas,
- pageSize: Int
- ) {
- var left = 0f
- for (i in 0 until pageSize) {
- val sliderWidth = (if (i == mIndicatorOptions.currentPosition) maxWidth else minWidth)
- mPaint.color =
- if (i == mIndicatorOptions.currentPosition) mIndicatorOptions.checkedSliderColor else mIndicatorOptions.normalSliderColor
- mRectF.set(left, 0f, left + sliderWidth, mIndicatorOptions.sliderHeight)
- drawRoundRect(canvas, mIndicatorOptions.sliderHeight, mIndicatorOptions.sliderHeight,false)
- left += sliderWidth + mIndicatorOptions.sliderGap
- }
- }
-
- private fun drawCheckedSlider(canvas: Canvas) {
- mPaint.color = mIndicatorOptions.checkedSliderColor
- when (mIndicatorOptions.slideMode) {
- IndicatorSlideMode.SMOOTH -> drawSmoothSlider(canvas)
- IndicatorSlideMode.WORM -> drawWormSlider(canvas)
- IndicatorSlideMode.COLOR -> drawColorSlider(canvas)
- }
- }
-
- private fun drawColorSlider(canvas: Canvas) {
- val currentPosition = mIndicatorOptions.currentPosition
- val slideProgress = mIndicatorOptions.slideProgress
- val left = currentPosition * minWidth + currentPosition * mIndicatorOptions.sliderGap
- if (slideProgress < 0.99) {
- val evaluate = argbEvaluator?.evaluate(
- slideProgress, mIndicatorOptions.checkedSliderColor, mIndicatorOptions.normalSliderColor
- )
- mPaint.color = (evaluate as Int)
- mRectF.set(left, 0f, left + minWidth, mIndicatorOptions.sliderHeight)
- drawRoundRect(canvas, mIndicatorOptions.sliderHeight, mIndicatorOptions.sliderHeight,false)
- }
-
- var nextSliderLeft = left + mIndicatorOptions.sliderGap + mIndicatorOptions.normalSliderWidth
- if (currentPosition == mIndicatorOptions.pageSize - 1) {
- nextSliderLeft = 0f
- }
- val evaluate = argbEvaluator?.evaluate(
- 1 - slideProgress, mIndicatorOptions.checkedSliderColor, mIndicatorOptions.normalSliderColor
- )
- mPaint.color = evaluate as Int
- mRectF.set(nextSliderLeft, 0f, nextSliderLeft + minWidth, mIndicatorOptions.sliderHeight)
- drawRoundRect(canvas, mIndicatorOptions.sliderHeight, mIndicatorOptions.sliderHeight,false)
- }
-
- private fun drawWormSlider(canvas: Canvas) {
- val sliderHeight = mIndicatorOptions.sliderHeight
- val slideProgress = mIndicatorOptions.slideProgress
- val currentPosition = mIndicatorOptions.currentPosition
- val distance = mIndicatorOptions.sliderGap + mIndicatorOptions.normalSliderWidth
- val startCoordinateX =
- IndicatorUtils.getCoordinateX(mIndicatorOptions, maxWidth, currentPosition)
- val left = startCoordinateX + (distance * (slideProgress - 0.5f) * 2.0f).coerceAtLeast(
- 0f
- ) - mIndicatorOptions.normalSliderWidth / 2
- val right = startCoordinateX + (distance * slideProgress * 2f).coerceAtMost(
- distance
- ) + mIndicatorOptions.normalSliderWidth / 2
- mRectF.set(left, 0f, right, sliderHeight)
- drawRoundRect(canvas, sliderHeight, sliderHeight,false)
- }
-
- private fun drawSmoothSlider(canvas: Canvas) {
- val currentPosition = mIndicatorOptions.currentPosition
- val indicatorGap = mIndicatorOptions.sliderGap
- val sliderHeight = mIndicatorOptions.sliderHeight
- val left =
- currentPosition * maxWidth + currentPosition * +indicatorGap + (maxWidth + indicatorGap) * mIndicatorOptions.slideProgress
- mRectF.set(left, 0f, left + maxWidth, sliderHeight)
- drawRoundRect(canvas, sliderHeight, sliderHeight,false)
- }
-
- protected open fun drawRoundRect(
- canvas: Canvas,
- rx: Float,
- ry: Float,
- isWidth:Boolean
- ) {
- drawDash(canvas)
- }
-
- protected open fun drawDash(canvas: Canvas) {}
-}
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/RoundRectDrawer.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/RoundRectDrawer.kt
deleted file mode 100644
index a2e9d41537..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/drawer/RoundRectDrawer.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.drawer
-
-import android.graphics.Canvas
-import android.graphics.LinearGradient
-import android.graphics.Shader
-import com.mogo.eagle.core.widget.indicator.option.IndicatorOptions
-
-
-/**
- *
- * Created by zhpan on 2019/11/26.
- * Description:
-
*
- */
-class RoundRectDrawer internal constructor(val indicatorOptions: IndicatorOptions) : RectDrawer(
- indicatorOptions
-) {
-
- override fun drawRoundRect(canvas: Canvas, rx: Float, ry: Float, isWidth: Boolean) {
- if(isWidth) {
- val linearGradient =
- LinearGradient(
- mRectF.left,
- (mRectF.bottom - mRectF.top) / 2,
- mRectF.right,
- (mRectF.bottom - mRectF.top) / 2,
- indicatorOptions.checkedSliderColor,
- indicatorOptions.checkedEndSliderColor,
- Shader.TileMode.CLAMP
- )
- mPaint.shader = linearGradient
- }else{
- mPaint.color = indicatorOptions.normalSliderColor
- mPaint.shader = null
- }
- canvas.drawRoundRect(mRectF, rx, ry, mPaint)
- }
-}
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/enums/IndicatorOrientation.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/enums/IndicatorOrientation.kt
deleted file mode 100644
index ac37b07cf1..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/enums/IndicatorOrientation.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.enums
-
-import android.widget.LinearLayout
-
-/**
- *
- * @author zhangpan
- * @date 2021/1/21
- */
-class IndicatorOrientation {
- companion object {
- const val INDICATOR_HORIZONTAL = LinearLayout.HORIZONTAL
- const val INDICATOR_VERTICAL = LinearLayout.VERTICAL
- const val INDICATOR_RTL = 3
- }
-}
\ No newline at end of file
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/enums/IndicatorSlideMode.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/enums/IndicatorSlideMode.kt
deleted file mode 100644
index dbc8f1ab86..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/enums/IndicatorSlideMode.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.enums
-
-/**
- *
- * Created by zhangpan on 2019-10-18.
- * Description:
-
*
- */
-interface IndicatorSlideMode {
- companion object {
- const val NORMAL = 0
- const val SMOOTH = 2
- const val WORM = 3
- const val SCALE = 4
- const val COLOR = 5
- }
-}
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/enums/IndicatorStyle.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/enums/IndicatorStyle.kt
deleted file mode 100644
index a6426da1f0..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/enums/IndicatorStyle.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.enums
-
-/**
- *
- * Created by zhangpan on 2019-10-18.
- * Description:
-
*
- */
-interface IndicatorStyle {
- companion object {
- const val CIRCLE = 0
- const val DASH = 1 shl 1
- const val ROUND_RECT = 1 shl 2
- }
-}
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/option/AttrsController.java b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/option/AttrsController.java
deleted file mode 100644
index 1341df1424..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/option/AttrsController.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.option;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Color;
-import android.util.AttributeSet;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-
-import com.mogo.eagle.core.widget.R;
-import com.mogo.eagle.core.widget.indicator.utils.IndicatorUtils;
-
-public class AttrsController {
-
- public static void initAttrs(@NonNull Context context, @Nullable AttributeSet attrs,
- IndicatorOptions indicatorOptions) {
- if (attrs != null) {
- TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.IndicatorView);
- int indicatorSlideMode = typedArray.getInt(R.styleable.IndicatorView_vpi_slide_mode, 0);
- int indicatorStyle = typedArray.getInt(R.styleable.IndicatorView_vpi_style, 0);
- int checkedColor = typedArray.getColor(R.styleable.IndicatorView_vpi_slider_checked_color,
- Color.parseColor("#6C6D72"));
- int normalColor = typedArray.getColor(R.styleable.IndicatorView_vpi_slider_normal_color,
- Color.parseColor("#8C18171C"));
- int orientation = typedArray.getInt(R.styleable.IndicatorView_vpi_orientation, 0);
- float radius = typedArray.getDimension(R.styleable.IndicatorView_vpi_slider_radius,
- IndicatorUtils.dp2px(8));
- indicatorOptions.setCheckedColor(checkedColor);
- indicatorOptions.setNormalSliderColor(normalColor);
- indicatorOptions.setOrientation(orientation);
- indicatorOptions.setIndicatorStyle(indicatorStyle);
- indicatorOptions.setSlideMode(indicatorSlideMode);
- indicatorOptions.setSliderWidth(radius * 2, radius * 2);
- typedArray.recycle();
- }
- }
-}
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/option/IndicatorOptions.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/option/IndicatorOptions.kt
deleted file mode 100644
index eb16af1323..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/option/IndicatorOptions.kt
+++ /dev/null
@@ -1,114 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.option
-
-import android.graphics.Color
-import com.mogo.eagle.core.widget.indicator.annotation.AIndicatorOrientation
-
-import com.mogo.eagle.core.widget.indicator.annotation.AIndicatorSlideMode
-import com.mogo.eagle.core.widget.indicator.annotation.AIndicatorStyle
-import com.mogo.eagle.core.widget.indicator.enums.IndicatorOrientation
-import com.mogo.eagle.core.widget.indicator.enums.IndicatorSlideMode
-import com.mogo.eagle.core.widget.indicator.utils.IndicatorUtils
-
-/**
- *
- * Created by zhpan on 2019/11/20.
- * Description:Indicator的配置参数
-
*
- */
-class IndicatorOptions {
-
- @AIndicatorOrientation
- var orientation = IndicatorOrientation.INDICATOR_HORIZONTAL
-
- @AIndicatorStyle
- var indicatorStyle: Int = 0
-
- /**
- * Indicator滑动模式,目前仅支持两种
- *
- * @see IndicatorSlideMode.NORMAL
- *
- * @see IndicatorSlideMode.SMOOTH
- */
- @AIndicatorSlideMode
- var slideMode: Int = 0
-
- /**
- * 页面size
- */
- var pageSize: Int = 0
-
- /**
- * 未选中时Indicator颜色
- */
- var normalSliderColor: Int = 0
-
- /**
- * 选中时Indicator颜色
- */
- var checkedSliderColor: Int = 0
- /**
- * 选中时IndicatorEnd颜色
- */
- var checkedEndSliderColor: Int = 0
-
- /**
- * Indicator间距
- */
- var sliderGap: Float = 0f
-
- var sliderHeight: Float = 0f
- get() = if (field > 0) field else normalSliderWidth / 2
-
- var normalSliderWidth: Float = 0f
-
- var checkedSliderWidth: Float = 0f
-
- /**
- * 指示器当前位置
- */
- var currentPosition: Int = 0
-
- /**
- * 从一个点滑动到另一个点的进度
- */
- var slideProgress: Float = 0f
-
- var showIndicatorOneItem: Boolean = false
-
- init {
- normalSliderWidth = IndicatorUtils.dp2px(8f)
- .toFloat()
- checkedSliderWidth = normalSliderWidth
- sliderGap = normalSliderWidth
- normalSliderColor = Color.parseColor("#8C18171C")
- checkedSliderColor = Color.parseColor("#8C6C6D72")
- slideMode = IndicatorSlideMode.NORMAL
- }
-
- fun setCheckedColor(checkedColor: Int) {
- this.checkedSliderColor = checkedColor
- }
-
- fun setSliderWidth(
- normalIndicatorWidth: Float,
- checkedIndicatorWidth: Float
- ) {
- this.normalSliderWidth = normalIndicatorWidth
- this.checkedSliderWidth = checkedIndicatorWidth
- }
-
- fun setSliderWidth(sliderWidth: Float) {
- setSliderWidth(sliderWidth, sliderWidth)
- }
-
- fun setSliderColor(
- normalColor: Int,
- checkedColor: Int,
- selectedEndColor: Int
- ) {
- this.normalSliderColor = normalColor
- this.checkedSliderColor = checkedColor
- this.checkedEndSliderColor = selectedEndColor
- }
-}
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/utils/IndicatorUtils.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/utils/IndicatorUtils.kt
deleted file mode 100644
index b78a869540..0000000000
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/indicator/utils/IndicatorUtils.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.mogo.eagle.core.widget.indicator.utils
-
-import android.content.res.Resources
-import com.mogo.eagle.core.widget.indicator.option.IndicatorOptions
-
-/**
- *
- * Created by zhangpan on 2020-01-20.
- * Description:
-
*
- */
-object IndicatorUtils {
-
- @JvmStatic
- fun dp2px(dpValue: Float): Int {
- return (0.5f + dpValue * Resources.getSystem().displayMetrics.density).toInt()
- }
-
- fun getCoordinateX(
- indicatorOptions: IndicatorOptions,
- maxDiameter: Float,
- index: Int
- ): Float {
- val normalIndicatorWidth = indicatorOptions.normalSliderWidth
- return maxDiameter / 2 + (normalIndicatorWidth + indicatorOptions.sliderGap) * index
- }
-
- fun getCoordinateY(maxDiameter: Float): Float {
- return maxDiameter / 2
- }
-}