ClockDrawable.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:FiveMinsMore 作者:
@Override
protected void onBoundsChange(Rect bounds) {
    super.onBoundsChange(bounds);

    rimRadius = Math.min(bounds.width(), bounds.height()) / 2f - rimPaint.getStrokeWidth();
    faceRadius = rimRadius - rimPaint.getStrokeWidth();
    screwRadius = rimPaint.getStrokeWidth() * 2;
    float hourHandLength = (float) (0.5 * faceRadius);
    float minuteHandLength = (float) (0.7 * faceRadius);
    float top = bounds.centerY() - screwRadius;

    hourHandPath.reset();
    hourHandPath.moveTo(bounds.centerX(), bounds.centerY());
    hourHandPath.addRect(bounds.centerX(), top, bounds.centerX(), top - hourHandLength, Direction.CCW);
    hourHandPath.close();

    minuteHandPath.reset();
    minuteHandPath.moveTo(bounds.centerX(), bounds.centerY());
    minuteHandPath.addRect(bounds.centerX(), top, bounds.centerX(), top - minuteHandLength, Direction.CCW);
    minuteHandPath.close();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号