Skip to content

Commit

Permalink
fix(android): fetchImage param should support different type
Browse files Browse the repository at this point in the history
  • Loading branch information
siguangli2018 authored and xuqingkuang committed Aug 5, 2020
1 parent d829ed4 commit 497ba71
Showing 1 changed file with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
import com.tencent.mtt.supportui.views.asyncimage.AsyncImageView;
import com.tencent.mtt.supportui.views.asyncimage.BackgroundDrawable;
import com.tencent.mtt.supportui.views.asyncimage.ContentDrawable;
import java.util.HashMap;
import java.util.Map;

/**
* Created by leonardgong on 2017/12/4 0004.
Expand Down Expand Up @@ -147,7 +149,7 @@ public void setIniProps(HippyMap iniProps) {
int width = 0;
int height = 0;

mIniProps.clear();
mIniProps.clear();

if (iniProps.containsKey(NodeProps.STYLE)) {
HippyMap styles = iniProps.getMap(NodeProps.STYLE);
Expand All @@ -160,15 +162,15 @@ public void setIniProps(HippyMap iniProps) {
height = Math.round(PixelUtil.dp2px(styles.getDouble(NodeProps.HEIGHT)));
}

if (styles.containsKey(NodeProps.RESIZE_MODE)) {
mIniProps.pushString(NodeProps.RESIZE_MODE, styles.getString(NodeProps.RESIZE_MODE));
}
if (styles.containsKey(NodeProps.RESIZE_MODE)) {
mIniProps.pushString(NodeProps.RESIZE_MODE, styles.getString(NodeProps.RESIZE_MODE));
}
}
}

if (iniProps.containsKey(NodeProps.CUSTOM_PROP_IMAGE_TYPE)) {
mIniProps.pushString(NodeProps.CUSTOM_PROP_IMAGE_TYPE, iniProps.getString(NodeProps.CUSTOM_PROP_IMAGE_TYPE));
}
mIniProps.pushString(NodeProps.CUSTOM_PROP_IMAGE_TYPE, iniProps.getString(NodeProps.CUSTOM_PROP_IMAGE_TYPE));
}

mIniProps.pushBoolean(NodeProps.CUSTOM_PROP_ISGIF, iniProps.getBoolean(NodeProps.CUSTOM_PROP_ISGIF));
mIniProps.pushInt(NodeProps.WIDTH, width);
Expand Down Expand Up @@ -233,8 +235,18 @@ protected void doFetchImage(Object param, final int sourceType)
{
if (mImageAdapter != null)
{
if (param != null) {
mIniProps.pushObject("extraData", param);
if (param == null)
{
param = new HashMap<String, Object>();
}

if (param instanceof Map)
{
try {
((Map) param).put("props", mIniProps);
} catch (Exception e) {

}
}

// 这里不判断下是取背景图片还是取当前图片怎么行?
Expand Down Expand Up @@ -275,7 +287,7 @@ public void onRequestFail(Throwable throwable, String source)
}
}
}
}, mIniProps);
}, param);
}
}
//用户设置了,Js属性设置背景色
Expand Down

0 comments on commit 497ba71

Please sign in to comment.