mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-07 17:37:34 +08:00
Implement border(Start|End)Color for rounded borders
Reviewed By: achen1 Differential Revision: D6014637 fbshipit-source-id: 33c10ec1f84075e0bb1c1f529aa7231497028380
This commit is contained in:
committed by
Facebook Github Bot
parent
38c2c26d90
commit
875f273dba
@@ -310,10 +310,48 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||
canvas.clipPath(mOuterClipPathForBorderRadius, Region.Op.INTERSECT);
|
||||
canvas.clipPath(mInnerClipPathForBorderRadius, Region.Op.DIFFERENCE);
|
||||
|
||||
final int colorLeft = getBorderColor(Spacing.LEFT);
|
||||
final int colorTop = getBorderColor(Spacing.TOP);
|
||||
final int colorRight = getBorderColor(Spacing.RIGHT);
|
||||
final int colorBottom = getBorderColor(Spacing.BOTTOM);
|
||||
int colorLeft = getBorderColor(Spacing.LEFT);
|
||||
int colorTop = getBorderColor(Spacing.TOP);
|
||||
int colorRight = getBorderColor(Spacing.RIGHT);
|
||||
int colorBottom = getBorderColor(Spacing.BOTTOM);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
final boolean isRTL = getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
|
||||
int colorStart = getBorderColor(Spacing.START);
|
||||
int colorEnd = getBorderColor(Spacing.END);
|
||||
|
||||
if (I18nUtil.getInstance().doesRTLFlipLeftAndRightStyles(mContext)) {
|
||||
if (!isBorderColorDefined(Spacing.START)) {
|
||||
colorStart = colorLeft;
|
||||
}
|
||||
|
||||
if (!isBorderColorDefined(Spacing.END)) {
|
||||
colorEnd = colorRight;
|
||||
}
|
||||
|
||||
final int directionAwareColorLeft = isRTL ? colorEnd : colorStart;
|
||||
final int directionAwareColorRight = isRTL ? colorStart : colorEnd;
|
||||
|
||||
colorLeft = directionAwareColorLeft;
|
||||
colorRight = directionAwareColorRight;
|
||||
} else {
|
||||
final int directionAwareColorLeft = isRTL ? colorEnd : colorStart;
|
||||
final int directionAwareColorRight = isRTL ? colorStart : colorEnd;
|
||||
|
||||
final boolean isColorStartDefined = isBorderColorDefined(Spacing.START);
|
||||
final boolean isColorEndDefined = isBorderColorDefined(Spacing.END);
|
||||
final boolean isDirectionAwareColorLeftDefined = isRTL ? isColorEndDefined : isColorStartDefined;
|
||||
final boolean isDirectionAwareColorRightDefined = isRTL ? isColorStartDefined : isColorEndDefined;
|
||||
|
||||
if (isDirectionAwareColorLeftDefined) {
|
||||
colorLeft = directionAwareColorLeft;
|
||||
}
|
||||
|
||||
if (isDirectionAwareColorRightDefined) {
|
||||
colorRight = directionAwareColorRight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final float left = mOuterClipTempRectForBorderRadius.left;
|
||||
final float right = mOuterClipTempRectForBorderRadius.right;
|
||||
|
||||
Reference in New Issue
Block a user