CircularProgressBar.java 文件源码

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

项目:Dashchan 作者:
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public CircularProgressBar(Context context, AttributeSet attrs) {
    super(context, attrs);
    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeCap(Paint.Cap.SQUARE);
    paint.setStrokeJoin(Paint.Join.MITER);
    if (C.API_LOLLIPOP) {
        Path startPath = new Path();
        startPath.lineTo(0.5f, 0f);
        startPath.cubicTo(0.7f, 0f, 0.6f, 1f, 1f, 1f);
        lollipopStartInterpolator = new PathInterpolator(startPath);
        Path endPath = new Path();
        endPath.cubicTo(0.2f, 0f, 0.1f, 1f, 0.5f, 1f);
        endPath.lineTo(1f, 1f);
        lollipopEndInterpolator = new PathInterpolator(endPath);
        indeterminateDrawable = null;
        indeterminateDuration = 0;
    } else {
        lollipopStartInterpolator = null;
        lollipopEndInterpolator = null;
        TypedArray typedArray = context.obtainStyledAttributes(android.R.style.Widget_Holo_ProgressBar_Large,
                new int[] {android.R.attr.indeterminateDrawable, android.R.attr.indeterminateDuration});
        indeterminateDrawable = typedArray.getDrawable(0);
        indeterminateDuration = typedArray.getInteger(1, 3500);
        typedArray.recycle();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号