Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void init(Context context, AttributeSet attrs, int defStyle) {
- if (attrs != null) {
- TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.CustomShapeImageView, defStyle, 0);
- mBorderWidth = typedArray.getDimensionPixelSize(R.styleable.CustomShapeImageView_civ_borderWidth, DEFAULT_BORDER_WIDTH);
- mBorderColor = typedArray.getColor(R.styleable.CustomShapeImageView_civ_borderColor, DEFAULT_BORDER_COLOR);
- mBorderRadius = typedArray.getDimensionPixelSize(R.styleable.CustomShapeImageView_civ_borderRadius, DEFAULT_BORDER_RADIUS);
- mShape = typedArray.getInt(R.styleable.CustomShapeImageView_civ_shape, DEFAULT_SHAPE);
- typedArray.recycle();
- }
- mHasBorder = mBorderWidth > 0 && mShape != SHAPE_STAR && mShape != SHAPE_HEART;
- mBitmapPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
- mBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
- mBorderPaint.setColor(mBorderColor);
- }
Advertisement
Add Comment
Please, Sign In to add comment