android: decode base64 image synchronously

This commit is contained in:
pengfei.zhou 2021-12-08 17:12:08 +08:00 committed by osborn
parent b1b100ccf4
commit 7f21d8293f

View File

@ -456,7 +456,11 @@ public class ImageNode extends ViewNode<ImageView> {
if (!TextUtils.isEmpty(imageType) && !TextUtils.isEmpty(base64)) { if (!TextUtils.isEmpty(imageType) && !TextUtils.isEmpty(base64)) {
try { try {
byte[] data = Base64.decode(base64, Base64.DEFAULT); byte[] data = Base64.decode(base64, Base64.DEFAULT);
loadIntoTarget(Glide.with(getContext()).load(data)); Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
view.setImageBitmap(bitmap);
if (!TextUtils.isEmpty(loadCallbackId)) {
callJSResponse(loadCallbackId);
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }