@@ -378,43 +378,41 @@ private void drawRoundedBackgroundWithBorders(Canvas canvas) {
378
378
canvas .clipPath (mOuterClipPathForBorderRadius , Region .Op .INTERSECT );
379
379
canvas .clipPath (mInnerClipPathForBorderRadius , Region .Op .DIFFERENCE );
380
380
381
- if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .JELLY_BEAN_MR1 ) {
382
- final boolean isRTL = getResolvedLayoutDirection () == View .LAYOUT_DIRECTION_RTL ;
383
- int colorStart = getBorderColor (Spacing .START );
384
- int colorEnd = getBorderColor (Spacing .END );
381
+ final boolean isRTL = getResolvedLayoutDirection () == View .LAYOUT_DIRECTION_RTL ;
382
+ int colorStart = getBorderColor (Spacing .START );
383
+ int colorEnd = getBorderColor (Spacing .END );
385
384
386
- if (I18nUtil .getInstance ().doLeftAndRightSwapInRTL (mContext )) {
387
- if (!isBorderColorDefined (Spacing .START )) {
388
- colorStart = colorLeft ;
389
- }
385
+ if (I18nUtil .getInstance ().doLeftAndRightSwapInRTL (mContext )) {
386
+ if (!isBorderColorDefined (Spacing .START )) {
387
+ colorStart = colorLeft ;
388
+ }
390
389
391
- if (!isBorderColorDefined (Spacing .END )) {
392
- colorEnd = colorRight ;
393
- }
390
+ if (!isBorderColorDefined (Spacing .END )) {
391
+ colorEnd = colorRight ;
392
+ }
393
+
394
+ final int directionAwareColorLeft = isRTL ? colorEnd : colorStart ;
395
+ final int directionAwareColorRight = isRTL ? colorStart : colorEnd ;
396
+
397
+ colorLeft = directionAwareColorLeft ;
398
+ colorRight = directionAwareColorRight ;
399
+ } else {
400
+ final int directionAwareColorLeft = isRTL ? colorEnd : colorStart ;
401
+ final int directionAwareColorRight = isRTL ? colorStart : colorEnd ;
394
402
395
- final int directionAwareColorLeft = isRTL ? colorEnd : colorStart ;
396
- final int directionAwareColorRight = isRTL ? colorStart : colorEnd ;
403
+ final boolean isColorStartDefined = isBorderColorDefined (Spacing .START );
404
+ final boolean isColorEndDefined = isBorderColorDefined (Spacing .END );
405
+ final boolean isDirectionAwareColorLeftDefined =
406
+ isRTL ? isColorEndDefined : isColorStartDefined ;
407
+ final boolean isDirectionAwareColorRightDefined =
408
+ isRTL ? isColorStartDefined : isColorEndDefined ;
397
409
410
+ if (isDirectionAwareColorLeftDefined ) {
398
411
colorLeft = directionAwareColorLeft ;
412
+ }
413
+
414
+ if (isDirectionAwareColorRightDefined ) {
399
415
colorRight = directionAwareColorRight ;
400
- } else {
401
- final int directionAwareColorLeft = isRTL ? colorEnd : colorStart ;
402
- final int directionAwareColorRight = isRTL ? colorStart : colorEnd ;
403
-
404
- final boolean isColorStartDefined = isBorderColorDefined (Spacing .START );
405
- final boolean isColorEndDefined = isBorderColorDefined (Spacing .END );
406
- final boolean isDirectionAwareColorLeftDefined =
407
- isRTL ? isColorEndDefined : isColorStartDefined ;
408
- final boolean isDirectionAwareColorRightDefined =
409
- isRTL ? isColorStartDefined : isColorEndDefined ;
410
-
411
- if (isDirectionAwareColorLeftDefined ) {
412
- colorLeft = directionAwareColorLeft ;
413
- }
414
-
415
- if (isDirectionAwareColorRightDefined ) {
416
- colorRight = directionAwareColorRight ;
417
- }
418
416
}
419
417
}
420
418
@@ -1255,7 +1253,7 @@ public RectF getDirectionAwareBorderInsets() {
1255
1253
float borderLeftWidth = getBorderWidthOrDefaultTo (borderWidth , Spacing .LEFT );
1256
1254
float borderRightWidth = getBorderWidthOrDefaultTo (borderWidth , Spacing .RIGHT );
1257
1255
1258
- if (Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN_MR1 && mBorderWidth != null ) {
1256
+ if (mBorderWidth != null ) {
1259
1257
final boolean isRTL = getResolvedLayoutDirection () == View .LAYOUT_DIRECTION_RTL ;
1260
1258
float borderStartWidth = mBorderWidth .getRaw (Spacing .START );
1261
1259
float borderEndWidth = mBorderWidth .getRaw (Spacing .END );
0 commit comments