pull/32/head
kunfei 5 years ago
parent cce8d12099
commit 8d93231ac8
  1. 28
      app/src/main/java/io/legado/app/ui/widget/anima/RotateLoading.kt

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

Loading…
Cancel
Save