在Ring中绘制三角处新增处理逻辑
private void drawTriangle(Canvas c, float startAngle, float sweepAngle, Rect bounds) {
if (mArrow == null) {
mArrow = new android.graphics.Path();
mArrow.setFillType(android.graphics.Path.FillType.EVEN_ODD);
} else {
mArrow.reset();
}
// Adjust the position of the triangle so that it is inset as
// much as the arc, but also centered on the arc.
float inset = (int) mStrokeInset / 2 * mArrowScale;
float x = (float) (mRingCenterRadius * Math.cos(0) + bounds.exactCenterX());
float y = (float) (mRingCenterRadius * Math.sin(0) + bounds.exactCenterY());
// Update the path each time. This works around an issue in SKIA
// where concatenating a rotation matrix to a scale matrix
// ignored a starting negative rotation. This appears to have
// been fixed as of API 21.
mArrow.moveTo(0, 0);
mArrow.lineTo(mArrowWidth * mArrowScale, 0);
mArrow.lineTo((mArrowWidth * mArrowScale / 2), (mArrowHeight
* mArrowScale));
mArrow.offset(x - inset, y);
mArrow.close();
// draw a triangle
mArrowPaint.setColor(mCurrentColor);
if (mIsBeingDragged) {
c.rotate(startAngle + sweepAngle, bounds.exactCenterX(),
bounds.exactCenterY());
} else { // 新增逻辑处理
c.rotate(startAngle, bounds.exactCenterX(),
bounds.exactCenterY());
}
c.drawPath(mArrow, mArrowPaint);
}
@Override public void onPullingDown(float fraction, float maxHeadHeight, float headHeight) { if (!mIsBeingDragged) { mIsBeingDragged = true; mProgress.setAlpha(STARTING_PROGRESS_ALPHA); }
}
在Ring中绘制三角处新增处理逻辑 private void drawTriangle(Canvas c, float startAngle, float sweepAngle, Rect bounds) { if (mArrow == null) { mArrow = new android.graphics.Path(); mArrow.setFillType(android.graphics.Path.FillType.EVEN_ODD); } else { mArrow.reset(); }