/* Android's elevation implementation requires this to be implemented to know where to draw the shadow. */ @Override public void getOutline(Outline outline) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { super.getOutline(outline); return; } if ((!CSSConstants.isUndefined(mBorderRadius) && mBorderRadius > 0) || mBorderCornerRadii != null) { updatePath(); outline.setConvexPath(mPathForBorderRadiusOutline); } else { outline.setRect(getBounds()); } }
private void drawRoundedBackgroundWithBorders(Canvas canvas) { updatePath(); int useColor = ColorUtil.multiplyColorAlpha(mColor, mAlpha); if ((useColor >>> 24) != 0) { // color is not transparent mPaint.setColor(useColor); mPaint.setStyle(Paint.Style.FILL); canvas.drawPath(mPathForBorderRadius, mPaint); } // maybe draw borders? float fullBorderWidth = getFullBorderWidth(); if (fullBorderWidth > 0) { int borderColor = getFullBorderColor(); mPaint.setColor(ColorUtil.multiplyColorAlpha(borderColor, mAlpha)); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeWidth(fullBorderWidth); canvas.drawPath(mPathForBorderRadius, mPaint); } }