diff --git a/doric-android/doric/src/main/java/pub/doric/shader/ImageNode.java b/doric-android/doric/src/main/java/pub/doric/shader/ImageNode.java index 240ae2f4..688cb961 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/ImageNode.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/ImageNode.java @@ -23,6 +23,7 @@ import android.util.Base64; import android.widget.ImageView; import com.bumptech.glide.Glide; +import com.bumptech.glide.RequestBuilder; import com.bumptech.glide.load.DataSource; import com.bumptech.glide.load.engine.GlideException; import com.bumptech.glide.request.RequestListener; @@ -36,6 +37,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import androidx.annotation.Nullable; + import jp.wasabeef.glide.transformations.BlurTransformation; import pub.doric.DoricContext; import pub.doric.extension.bridge.DoricPlugin; @@ -62,9 +64,9 @@ public class ImageNode extends ViewNode { @Override public void blend(JSObject jsObject) { - if(jsObject != null) { + if (jsObject != null) { JSValue jsValue = jsObject.getProperty("isBlur"); - if(jsValue.isBoolean()) { + if (jsValue.isBoolean()) { isBlur = jsValue.asBoolean().value(); } } @@ -75,14 +77,14 @@ public class ImageNode extends ViewNode { protected void blend(ImageView view, String name, JSValue prop) { switch (name) { case "imageUrl": - RequestOptions options; - if(isBlur) { - options = RequestOptions.bitmapTransform(new BlurTransformation(25, 3)); - } else { - options = new RequestOptions(); + + RequestBuilder requestBuilder = Glide.with(getContext()).load(prop.asString().value()); + if (isBlur) { + requestBuilder = requestBuilder + .apply(RequestOptions + .bitmapTransform(new BlurTransformation(25, 3))); } - Glide.with(getContext()).load(prop.asString().value()) - .apply(options) + requestBuilder .listener(new RequestListener() { @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) {