ContactBadge.java 文件源码

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

项目:Android-ContactPicker 作者:
private void initSquare(Context context) {
    if (mTriangle == null) {
        TypedValue typedValue = new TypedValue();
        Theme theme = context.getTheme();

        // triangle
        Path chipPath = new Path();
        chipPath.moveTo(500f, 0f);
        chipPath.lineTo(500f, 500f);
        chipPath.lineTo(0f, 500f);
        chipPath.close();
        mTriangle = new ShapeDrawable(new PathShape(chipPath, 500f, 500f));
        mTriangle.setDither(true);
        int triangleColor = Color.parseColor("#cc1f1f1f");
        if (theme.resolveAttribute(R.attr.cp_badgeTriangleColor, typedValue, true)) {
            triangleColor = typedValue.data;
        }
        mTriangle.getPaint().setColor(triangleColor);

        // line
        mLinePaint = new Paint();
        int lineColor = Color.parseColor("#ffffffff");
        if (theme.resolveAttribute(R.attr.cp_badgeLineColor, typedValue, true)) {
            lineColor = typedValue.data;
        }
        mLinePaint.setColor(lineColor);
        mOffset = 1.5f * mDensity;
        mLinePaint.setStrokeWidth(mOffset);
    }

    initOverlay(context, new RectShape());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号