use of com.taobao.weex.ui.view.WXImageView in project weex-example by KalicyZhou.
the class WXImage method initComponentHostView.
@Override
protected ImageView initComponentHostView(@NonNull Context context) {
WXImageView view = new WXImageView(context);
view.setScaleType(ScaleType.FIT_XY);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
view.setCropToPadding(true);
}
view.holdComponent(this);
return view;
}
use of com.taobao.weex.ui.view.WXImageView in project weex-example by KalicyZhou.
the class WXImage method updateProperties.
@Override
public void updateProperties(Map<String, Object> props) {
super.updateProperties(props);
WXImageView imageView;
ImmutableDomObject imageDom;
if ((imageDom = getDomObject()) != null && getHostView() instanceof WXImageView) {
imageView = (WXImageView) getHostView();
BorderDrawable borderDrawable = WXViewUtils.getBorderDrawable(getHostView());
float[] borderRadius;
if (borderDrawable != null) {
RectF borderBox = new RectF(0, 0, WXDomUtils.getContentWidth(imageDom), WXDomUtils.getContentHeight(imageDom));
borderRadius = borderDrawable.getBorderRadius(borderBox);
} else {
borderRadius = new float[] { 0, 0, 0, 0, 0, 0, 0, 0 };
}
imageView.setBorderRadius(borderRadius);
if (imageView.getDrawable() instanceof ImageDrawable) {
ImageDrawable imageDrawable = (ImageDrawable) imageView.getDrawable();
float[] previousRadius = imageDrawable.getCornerRadii();
if (!Arrays.equals(previousRadius, borderRadius)) {
imageDrawable.setCornerRadii(borderRadius);
}
}
readyToRender();
}
}
Aggregations