feat:Aero add style property

This commit is contained in:
pengfei.zhou
2021-11-25 16:30:29 +08:00
committed by osborn
parent cc014a6061
commit f302592d11
13 changed files with 67 additions and 5 deletions

View File

@@ -25,7 +25,7 @@ android {
}
afterEvaluate {
buildJSBundle.exec()
//buildJSBundle.exec()
}
task buildJSBundle(type: Exec) {

View File

@@ -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);

View File

@@ -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);
}