docs: @SuppressLint("DrawAllocation")
      @Override
      protected void onDraw(Canvas canvas) {
          super.onDraw(canvas);
  
          final int restore = canvas.save();
  
          final int cx = getMeasuredWidth() / 2;
          final int cy = getMeasuredHeight() / 2;
          final int radius = getMeasuredWidth() / 2 - strokeWidth / 2;
  
          float drawPercent = percent;
          if (drawPercent > 0.97 && drawPercent < 1) {
              // 设计师说这样比较好
              drawPercent = 0.97f;
          }
  
          // 画渐变圆
          canvas.save();
          canvas.rotate(-90, cx, cy);
          int[] colors;
          float[] positions;
          if (drawPercent < 1 && drawPercent > 0) {
              calculatePercentEndColor(drawPercent);
              customColors[1] = percentEndColor;
              colors = customColors;
              customPositions[1] = drawPercent;
              customPositions[2] = drawPercent;
              positions = customPositions;
          } else if (drawPercent == 1) {
              percentEndColor = endColor;
              colors = fullColors;
              positions = extremePositions;
          } else {
              // <= 0 || > 1?
              colors = emptyColors;
              positions = extremePositions;
          }
          final SweepGradient sweepGradient = new SweepGradient(getMeasuredWidth() / 2, getMeasuredHeight() / 2, colors, positions);
          paint.setShader(sweepGradient);
          canvas.drawCircle(cx, cy, radius, paint);
          canvas.restore();
  
          if (drawPercent > 0) {
              // 绘制结束的半圆
              if (drawPercent < 1 || (isFootOverHead && drawPercent == 1)) {
                  canvas.save();
                  endPaint.setColor(percentEndColor);
                  canvas.rotate((int) Math.floor(360.0f * drawPercent) - 1, cx, cy);
                  canvas.drawArc(rectF, -90f, 180f, true, endPaint);
                  canvas.restore();
              }
              if (!isFootOverHead || drawPercent < 1) {
                  canvas.save();
                  // 绘制开始的半圆
                  canvas.drawArc(rectF, 90f, 180f, true, startPaint);
                  canvas.restore();
              }
          }
  
  
          canvas.restoreToCount(restore);
  
      }