mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 10:01:08 +08:00
fix(android): box shadow and border radius white border resolution (#10125)
This commit is contained in:

committed by
GitHub

parent
7eaafa519e
commit
ea45758463
Binary file not shown.
@ -43,12 +43,19 @@ public class BoxShadowDrawable extends LayerDrawable {
|
||||
Log.d(TAG, "Constructing BoxShadowDrawable!");
|
||||
|
||||
this.shadowLayer = new ShapeDrawable(new RectShape());
|
||||
this.overlayLayer = this.createOverlayLayer();
|
||||
this.wrappedLayer = wrappedDrawable;
|
||||
|
||||
if(shouldHideOverlayLayer()) {
|
||||
this.overlayLayer = null;
|
||||
} else {
|
||||
this.overlayLayer = this.createOverlayLayer();
|
||||
}
|
||||
|
||||
// add our layers
|
||||
this.addLayer(shadowLayer);
|
||||
this.addLayer(overlayLayer);
|
||||
if(this.overlayLayer != null) {
|
||||
this.addLayer(overlayLayer);
|
||||
}
|
||||
this.addLayer(wrappedLayer);
|
||||
|
||||
this.setValue(value);
|
||||
@ -100,7 +107,9 @@ public class BoxShadowDrawable extends LayerDrawable {
|
||||
if (!Arrays.equals(outerRadius, currentCornerRadii)) {
|
||||
Log.d(TAG, "Update layer shape");
|
||||
shadowLayer.setShape(new RoundRectShape(outerRadius, null, null));
|
||||
overlayLayer.setShape(new RoundRectShape(outerRadius, null, null));
|
||||
if(overlayLayer != null) {
|
||||
overlayLayer.setShape(new RoundRectShape(outerRadius, null, null));
|
||||
}
|
||||
|
||||
// update current
|
||||
currentCornerRadii = outerRadius;
|
||||
@ -148,6 +157,17 @@ public class BoxShadowDrawable extends LayerDrawable {
|
||||
return shapeDrawable;
|
||||
}
|
||||
|
||||
private boolean shouldHideOverlayLayer() {
|
||||
if (wrappedLayer instanceof BorderDrawable) {
|
||||
BorderDrawable bd = (BorderDrawable) this.wrappedLayer;
|
||||
if (bd.getBackgroundColor() != 0 || bd.getBackgroundBitmap() != null || bd.getBackgroundGradient() != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BoxShadowDrawable { oX:" + offsetX + " oY:" + offsetY + " br:" + blurRadius + " sr:" + spreadRadius + " c:" + shadowColor + " }";
|
||||
|
Reference in New Issue
Block a user