@Test public void testSetSrc() throws Exception { TestDomObject.setAttribute((WXDomObject)mWXImage.getDomObject(),PowerMockito.mock(WXAttr.class)); PowerMockito.when(mWXImage.getDomObject().getAttrs().getImageSharpen()).thenReturn(WXImageSharpen.SHARPEN); mWXImage.setSrc(""); }
@WXComponentProp(name = Constants.Name.SRC) public void setSrc(String src) { if (src == null) { return; } ImageView image = getHostView(); if("".equals(src) && image != null){ image.setImageDrawable(null); return; } if(image != null){ if(image.getDrawable() != null){ image.setImageDrawable(null); } } this.mSrc = src; WXSDKInstance instance = getInstance(); Uri rewrited = instance.rewriteUri(Uri.parse(src), URIAdapter.IMAGE); if (Constants.Scheme.LOCAL.equals(rewrited.getScheme())) { setLocalSrc(rewrited); } else { int blur = 0; String blurStr = getStyles().getBlur(); blur = parseBlurRadius(blurStr); setRemoteSrc(rewrited, blur); } }
WXImage extends WXComponent<ImageView> { @WXComponentProp(name = Constants.Name.SRC) public void setSrc(String src) { if (src == null) { return; } ImageView image = getHostView(); if("".equals(src) && image != null){ image.setImageDrawable(null); return; } if(image != null){ if(image.getDrawable() != null){ image.setImageDrawable(null); } } this.mSrc = src; WXSDKInstance instance = getInstance(); Uri rewrited = instance.rewriteUri(Uri.parse(src), URIAdapter.IMAGE); if (Constants.Scheme.LOCAL.equals(rewrited.getScheme())) { setLocalSrc(rewrited); } else { int blur = 0; String blurStr = getStyles().getBlur(); blur = parseBlurRadius(blurStr); setRemoteSrc(rewrited, blur); } } }
WXImage extends WXComponent<ImageView> { @WXComponentProp(name = Constants.Name.SRC) public void setSrc(String src) { if (src == null) { return; } ImageView image = getHostView(); if("".equals(src) && image != null){ image.setImageDrawable(null); return; } if(image != null){ if(image.getDrawable() != null){ image.setImageDrawable(null); } } this.mSrc = src; WXSDKInstance instance = getInstance(); Uri rewrited = instance.rewriteUri(Uri.parse(src), URIAdapter.IMAGE); if (Constants.Scheme.LOCAL.equals(rewrited.getScheme())) { setLocalSrc(rewrited); } else { int blur = 0; String blurStr = getStyles().getBlur(); blur = parseBlurRadius(blurStr); setRemoteSrc(rewrited, blur); } } @Deprecated  WXImage(WXSDKInstance instance, WXVContainer parent, String instanceId, boolean isLazy, BasicComponentData basicComponentData);  WXImage(WXSDKInstance instance, WXVContainer parent, BasicComponentData basicComponentData); }
WXImage extends WXComponent<ImageView> { @WXComponentProp(name = Constants.Name.SRC) public void setSrc(String src) { if (src == null) { return; } ImageView image = getHostView(); if("".equals(src) && image != null){ image.setImageDrawable(null); return; } if(image != null){ if(image.getDrawable() != null){ image.setImageDrawable(null); } } this.mSrc = src; WXSDKInstance instance = getInstance(); Uri rewrited = instance.rewriteUri(Uri.parse(src), URIAdapter.IMAGE); if (Constants.Scheme.LOCAL.equals(rewrited.getScheme())) { setLocalSrc(rewrited); } else { int blur = 0; String blurStr = getStyles().getBlur(); blur = parseBlurRadius(blurStr); setRemoteSrc(rewrited, blur); } } @Deprecated  WXImage(WXSDKInstance instance, WXVContainer parent, String instanceId, boolean isLazy, BasicComponentData basicComponentData);  WXImage(WXSDKInstance instance, WXVContainer parent, BasicComponentData basicComponentData); @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(); void autoReleaseImage(); void autoRecoverImage(); @Override void updateProperties(Map<String, Object> props); @JSMethod(uiThread = false) void save(final JSCallback saveStatuCallback); @Override void destroy(); }
WXImage extends WXComponent<ImageView> { @WXComponentProp(name = Constants.Name.SRC) public void setSrc(String src) { if (src == null) { return; } ImageView image = getHostView(); if("".equals(src) && image != null){ image.setImageDrawable(null); return; } if(image != null){ if(image.getDrawable() != null){ image.setImageDrawable(null); } } this.mSrc = src; WXSDKInstance instance = getInstance(); Uri rewrited = instance.rewriteUri(Uri.parse(src), URIAdapter.IMAGE); if (Constants.Scheme.LOCAL.equals(rewrited.getScheme())) { setLocalSrc(rewrited); } else { int blur = 0; String blurStr = getStyles().getBlur(); blur = parseBlurRadius(blurStr); setRemoteSrc(rewrited, blur); } } @Deprecated  WXImage(WXSDKInstance instance, WXVContainer parent, String instanceId, boolean isLazy, BasicComponentData basicComponentData);  WXImage(WXSDKInstance instance, WXVContainer parent, BasicComponentData basicComponentData); @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(); void autoReleaseImage(); void autoRecoverImage(); @Override void updateProperties(Map<String, Object> props); @JSMethod(uiThread = false) void save(final JSCallback saveStatuCallback); @Override void destroy(); static final String SUCCEED; static final String ERRORDESC; }