Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. private void init(Context context, AttributeSet attrs, int defStyle) {
  2. if (attrs != null) {
  3. TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.CustomShapeImageView, defStyle, 0);
  4.  
  5. mBorderWidth = typedArray.getDimensionPixelSize(R.styleable.CustomShapeImageView_civ_borderWidth, DEFAULT_BORDER_WIDTH);
  6. mBorderColor = typedArray.getColor(R.styleable.CustomShapeImageView_civ_borderColor, DEFAULT_BORDER_COLOR);
  7. mBorderRadius = typedArray.getDimensionPixelSize(R.styleable.CustomShapeImageView_civ_borderRadius, DEFAULT_BORDER_RADIUS);
  8. mShape = typedArray.getInt(R.styleable.CustomShapeImageView_civ_shape, DEFAULT_SHAPE);
  9.  
  10. typedArray.recycle();
  11. }
  12.  
  13. mHasBorder = mBorderWidth > 0 && mShape != SHAPE_STAR && mShape != SHAPE_HEART;
  14.  
  15. mBitmapPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
  16. mBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
  17. mBorderPaint.setColor(mBorderColor);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement