@Test public void testSetProperty() throws Exception { ImageView imageView = mWXImage.initComponentHostView(Robolectric.setupActivity(TestActivity.class)); mWXImage.mHost = imageView; mWXImage.setProperty(Constants.Name.RESIZE_MODE, "cover"); ImageView.ScaleType scaleType = mWXImage.getHostView().getScaleType(); assertEquals(scaleType, ImageView.ScaleType.CENTER_CROP); }
@Override protected boolean setProperty(String key, Object param) { switch (key) { case Constants.Name.RESIZE_MODE: String resize_mode = WXUtils.getString(param, null); if (resize_mode != null) setResizeMode(resize_mode); return true; case Constants.Name.RESIZE: String resize = WXUtils.getString(param, null); if (resize != null) setResize(resize); return true; case Constants.Name.SRC: String src = WXUtils.getString(param, null); if (src != null) setSrc(src); return true; case Constants.Name.IMAGE_QUALITY: return true; case Constants.Name.FILTER: int blurRadius = 0; if(param != null && param instanceof String) { blurRadius = parseBlurRadius((String)param); } if(!TextUtils.isEmpty(this.mSrc)) { setBlurRadius(this.mSrc,blurRadius); } return true; } return super.setProperty(key, param); }
WXImage extends WXComponent<ImageView> { @Override protected boolean setProperty(String key, Object param) { switch (key) { case Constants.Name.RESIZE_MODE: String resize_mode = WXUtils.getString(param, null); if (resize_mode != null) setResizeMode(resize_mode); return true; case Constants.Name.RESIZE: String resize = WXUtils.getString(param, null); if (resize != null) setResize(resize); return true; case Constants.Name.SRC: String src = WXUtils.getString(param, null); if (src != null) setSrc(src); return true; case Constants.Name.IMAGE_QUALITY: return true; case Constants.Name.FILTER: int blurRadius = 0; if(param != null && param instanceof String) { blurRadius = parseBlurRadius((String)param); } if(!TextUtils.isEmpty(this.mSrc)) { setBlurRadius(this.mSrc,blurRadius); } return true; } return super.setProperty(key, param); } }
WXImage extends WXComponent<ImageView> { @Override protected boolean setProperty(String key, Object param) { switch (key) { case Constants.Name.RESIZE_MODE: String resize_mode = WXUtils.getString(param, null); if (resize_mode != null) setResizeMode(resize_mode); return true; case Constants.Name.RESIZE: String resize = WXUtils.getString(param, null); if (resize != null) setResize(resize); return true; case Constants.Name.SRC: String src = WXUtils.getString(param, null); if (src != null) setSrc(src); return true; case Constants.Name.IMAGE_QUALITY: return true; case Constants.Name.FILTER: int blurRadius = 0; if(param != null && param instanceof String) { blurRadius = parseBlurRadius((String)param); } if(!TextUtils.isEmpty(this.mSrc)) { setBlurRadius(this.mSrc,blurRadius); } return true; } return super.setProperty(key, param); } @Deprecated  WXImage(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, String instanceId, boolean isLazy);  WXImage(WXSDKInstance instance, WXDomObject node,
                  WXVContainer parent); }
WXImage extends WXComponent<ImageView> { @Override protected boolean setProperty(String key, Object param) { switch (key) { case Constants.Name.RESIZE_MODE: String resize_mode = WXUtils.getString(param, null); if (resize_mode != null) setResizeMode(resize_mode); return true; case Constants.Name.RESIZE: String resize = WXUtils.getString(param, null); if (resize != null) setResize(resize); return true; case Constants.Name.SRC: String src = WXUtils.getString(param, null); if (src != null) setSrc(src); return true; case Constants.Name.IMAGE_QUALITY: return true; case Constants.Name.FILTER: int blurRadius = 0; if(param != null && param instanceof String) { blurRadius = parseBlurRadius((String)param); } if(!TextUtils.isEmpty(this.mSrc)) { setBlurRadius(this.mSrc,blurRadius); } return true; } return super.setProperty(key, param); } @Deprecated  WXImage(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, String instanceId, boolean isLazy);  WXImage(WXSDKInstance instance, WXDomObject node,
                  WXVContainer parent); @Override void refreshData(WXComponent component); @WXComponentProp(name = Constants.Name.RESIZE_MODE) void setResizeMode(String resizeMode); @WXComponentProp(name = Constants.Name.RESIZE) void setResize(String resize); @WXComponentProp(name = Constants.Name.SRC) void setSrc(String src); @Override void recycled(); @Override void updateProperties(Map<String, Object> props); }
WXImage extends WXComponent<ImageView> { @Override protected boolean setProperty(String key, Object param) { switch (key) { case Constants.Name.RESIZE_MODE: String resize_mode = WXUtils.getString(param, null); if (resize_mode != null) setResizeMode(resize_mode); return true; case Constants.Name.RESIZE: String resize = WXUtils.getString(param, null); if (resize != null) setResize(resize); return true; case Constants.Name.SRC: String src = WXUtils.getString(param, null); if (src != null) setSrc(src); return true; case Constants.Name.IMAGE_QUALITY: return true; case Constants.Name.FILTER: int blurRadius = 0; if(param != null && param instanceof String) { blurRadius = parseBlurRadius((String)param); } if(!TextUtils.isEmpty(this.mSrc)) { setBlurRadius(this.mSrc,blurRadius); } return true; } return super.setProperty(key, param); } @Deprecated  WXImage(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, String instanceId, boolean isLazy);  WXImage(WXSDKInstance instance, WXDomObject node,
                  WXVContainer parent); @Override void refreshData(WXComponent component); @WXComponentProp(name = Constants.Name.RESIZE_MODE) void setResizeMode(String resizeMode); @WXComponentProp(name = Constants.Name.RESIZE) void setResize(String resize); @WXComponentProp(name = Constants.Name.SRC) void setSrc(String src); @Override void recycled(); @Override void updateProperties(Map<String, Object> props);  }