|
|
@ -21,7 +21,7 @@ import io.legado.app.utils.dp |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class RotateLoading : View { |
|
|
|
class RotateLoading : View { |
|
|
|
|
|
|
|
|
|
|
|
private var mPaint: Paint? = null |
|
|
|
private lateinit var mPaint: Paint |
|
|
|
|
|
|
|
|
|
|
|
private var loadingRectF: RectF? = null |
|
|
|
private var loadingRectF: RectF? = null |
|
|
|
private var shadowRectF: RectF? = null |
|
|
|
private var shadowRectF: RectF? = null |
|
|
@ -77,11 +77,11 @@ class RotateLoading : View { |
|
|
|
} |
|
|
|
} |
|
|
|
speedOfArc = (speedOfDegree / 4).toFloat() |
|
|
|
speedOfArc = (speedOfDegree / 4).toFloat() |
|
|
|
mPaint = Paint() |
|
|
|
mPaint = Paint() |
|
|
|
mPaint?.color = loadingColor |
|
|
|
mPaint.color = loadingColor |
|
|
|
mPaint?.isAntiAlias = true |
|
|
|
mPaint.isAntiAlias = true |
|
|
|
mPaint?.style = Paint.Style.STROKE |
|
|
|
mPaint.style = Paint.Style.STROKE |
|
|
|
mPaint?.strokeWidth = thisWidth.toFloat() |
|
|
|
mPaint.strokeWidth = thisWidth.toFloat() |
|
|
|
mPaint?.strokeCap = Paint.Cap.ROUND |
|
|
|
mPaint.strokeCap = Paint.Cap.ROUND |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { |
|
|
|
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { |
|
|
@ -112,13 +112,17 @@ class RotateLoading : View { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mPaint?.color = Color.parseColor("#1a000000") |
|
|
|
mPaint.color = Color.parseColor("#1a000000") |
|
|
|
canvas.drawArc(shadowRectF!!, topDegree.toFloat(), arc, false, mPaint!!) |
|
|
|
shadowRectF?.let { |
|
|
|
canvas.drawArc(shadowRectF!!, bottomDegree.toFloat(), arc, false, mPaint!!) |
|
|
|
canvas.drawArc(it, topDegree.toFloat(), arc, false, mPaint) |
|
|
|
|
|
|
|
canvas.drawArc(it, bottomDegree.toFloat(), arc, false, mPaint) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mPaint?.color = loadingColor |
|
|
|
mPaint.color = loadingColor |
|
|
|
canvas.drawArc(loadingRectF!!, topDegree.toFloat(), arc, false, mPaint!!) |
|
|
|
loadingRectF?.let { |
|
|
|
canvas.drawArc(loadingRectF!!, bottomDegree.toFloat(), arc, false, mPaint!!) |
|
|
|
canvas.drawArc(it, topDegree.toFloat(), arc, false, mPaint) |
|
|
|
|
|
|
|
canvas.drawArc(it, bottomDegree.toFloat(), arc, false, mPaint) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
topDegree += speedOfDegree |
|
|
|
topDegree += speedOfDegree |
|
|
|
bottomDegree += speedOfDegree |
|
|
|
bottomDegree += speedOfDegree |
|
|
|