feat:Aero add style property
This commit is contained in:
@@ -19,7 +19,6 @@ import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
@@ -44,6 +43,8 @@ public class AeroEffectView extends DoricLayer {
|
||||
private Bitmap mScaledBitmap = null;
|
||||
private Canvas mScaledCanvas = null;
|
||||
|
||||
private String mStyle = null;
|
||||
|
||||
public AeroEffectView(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
@@ -54,6 +55,11 @@ public class AeroEffectView extends DoricLayer {
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setStyle(String style) {
|
||||
this.mStyle = style;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
if (mFullBitmap == null
|
||||
@@ -97,6 +103,11 @@ public class AeroEffectView extends DoricLayer {
|
||||
new Rect(0, 0, scaledWidth, scaledHeight),
|
||||
paint);
|
||||
blurredBitmap = DoricUtils.blur(getContext(), mScaledBitmap, radius);
|
||||
if ("dark".equals(mStyle)) {
|
||||
mScaledCanvas.drawColor(0x66000000, PorterDuff.Mode.SRC_OVER);
|
||||
} else if ("extraLight".equals(mStyle)) {
|
||||
mScaledCanvas.drawColor(0x99ffffff, PorterDuff.Mode.SRC_OVER);
|
||||
}
|
||||
if (mEffectiveRect != null) {
|
||||
mFullCanvas.save();
|
||||
mFullCanvas.clipRect(mEffectiveRect);
|
||||
|
@@ -51,6 +51,12 @@ public class AeroEffectViewNode extends StackNode {
|
||||
int height = DoricUtils.dp2px(prop.asObject().getProperty("height").asNumber().toFloat());
|
||||
((AeroEffectView) view).setEffectiveRect(new Rect(x, y, x + width, y + height));
|
||||
}
|
||||
} else if ("style".equals(name)) {
|
||||
if(prop.isString()){
|
||||
((AeroEffectView) view).setStyle(prop.asString().value());
|
||||
}else{
|
||||
((AeroEffectView) view).setStyle(null);
|
||||
}
|
||||
} else {
|
||||
super.blend(view, name, prop);
|
||||
}
|
||||
|
Reference in New Issue
Block a user