mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +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!");
|
Log.d(TAG, "Constructing BoxShadowDrawable!");
|
||||||
|
|
||||||
this.shadowLayer = new ShapeDrawable(new RectShape());
|
this.shadowLayer = new ShapeDrawable(new RectShape());
|
||||||
this.overlayLayer = this.createOverlayLayer();
|
|
||||||
this.wrappedLayer = wrappedDrawable;
|
this.wrappedLayer = wrappedDrawable;
|
||||||
|
|
||||||
|
if(shouldHideOverlayLayer()) {
|
||||||
|
this.overlayLayer = null;
|
||||||
|
} else {
|
||||||
|
this.overlayLayer = this.createOverlayLayer();
|
||||||
|
}
|
||||||
|
|
||||||
// add our layers
|
// add our layers
|
||||||
this.addLayer(shadowLayer);
|
this.addLayer(shadowLayer);
|
||||||
|
if(this.overlayLayer != null) {
|
||||||
this.addLayer(overlayLayer);
|
this.addLayer(overlayLayer);
|
||||||
|
}
|
||||||
this.addLayer(wrappedLayer);
|
this.addLayer(wrappedLayer);
|
||||||
|
|
||||||
this.setValue(value);
|
this.setValue(value);
|
||||||
@ -100,7 +107,9 @@ public class BoxShadowDrawable extends LayerDrawable {
|
|||||||
if (!Arrays.equals(outerRadius, currentCornerRadii)) {
|
if (!Arrays.equals(outerRadius, currentCornerRadii)) {
|
||||||
Log.d(TAG, "Update layer shape");
|
Log.d(TAG, "Update layer shape");
|
||||||
shadowLayer.setShape(new RoundRectShape(outerRadius, null, null));
|
shadowLayer.setShape(new RoundRectShape(outerRadius, null, null));
|
||||||
|
if(overlayLayer != null) {
|
||||||
overlayLayer.setShape(new RoundRectShape(outerRadius, null, null));
|
overlayLayer.setShape(new RoundRectShape(outerRadius, null, null));
|
||||||
|
}
|
||||||
|
|
||||||
// update current
|
// update current
|
||||||
currentCornerRadii = outerRadius;
|
currentCornerRadii = outerRadius;
|
||||||
@ -148,6 +157,17 @@ public class BoxShadowDrawable extends LayerDrawable {
|
|||||||
return shapeDrawable;
|
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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "BoxShadowDrawable { oX:" + offsetX + " oY:" + offsetY + " br:" + blurRadius + " sr:" + spreadRadius + " c:" + shadowColor + " }";
|
return "BoxShadowDrawable { oX:" + offsetX + " oY:" + offsetY + " br:" + blurRadius + " sr:" + spreadRadius + " c:" + shadowColor + " }";
|
||||||
|
Reference in New Issue
Block a user