use of com.taobao.weex.ui.component.WXComponentProp in project WeexErosFramework by bmfe.
the class HookInput method setTintColor.
// benmu.org
@WXComponentProp(name = HookConstants.NAME.TINTCOLOR)
public void setTintColor(String tintColor) {
if (TextUtils.isEmpty(tintColor))
return;
try {
EditText editText = getHostView();
Field cursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
cursorDrawableRes.setAccessible(true);
int drawableId = cursorDrawableRes.getInt(editText);
Field mEditor = TextView.class.getDeclaredField("mEditor");
mEditor.setAccessible(true);
Object editor = mEditor.get(editText);
Class<?> clazz = editor.getClass();
Field mCursorDrawable = clazz.getDeclaredField("mCursorDrawable");
mCursorDrawable.setAccessible(true);
Drawable[] drawables = new Drawable[1];
drawables[0] = editText.getContext().getResources().getDrawable(drawableId);
drawables[0].setColorFilter(WXResourceUtils.getColor(tintColor), PorterDuff.Mode.SRC_IN);
mCursorDrawable.set(editor, drawables);
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
use of com.taobao.weex.ui.component.WXComponentProp in project WeexErosFramework by bmfe.
the class HookImage method 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;
if (getDomObject() != null) {
String blurStr = getDomObject().getStyles().getBlur();
blur = parseBlurRadius(blurStr);
}
setRemoteSrc(rewrited, blur);
}
}
use of com.taobao.weex.ui.component.WXComponentProp in project incubator-weex by apache.
the class WXRecyclerTemplateList method setColumnWidth.
@WXComponentProp(name = Constants.Name.COLUMN_WIDTH)
public void setColumnWidth(int columnCount) {
if (mDomObject.getColumnWidth() != mColumnWidth) {
updateRecyclerAttr();
WXRecyclerView wxRecyclerView = getHostView().getInnerView();
wxRecyclerView.initView(getContext(), mLayoutType, mColumnCount, mColumnGap, getOrientation());
}
}
use of com.taobao.weex.ui.component.WXComponentProp in project incubator-weex by apache.
the class WXRecyclerTemplateList method setColumnCount.
@WXComponentProp(name = Constants.Name.COLUMN_COUNT)
public void setColumnCount(int columnCount) {
if (mDomObject.getColumnCount() != mColumnCount) {
updateRecyclerAttr();
WXRecyclerView wxRecyclerView = getHostView().getInnerView();
wxRecyclerView.initView(getContext(), mLayoutType, mColumnCount, mColumnGap, getOrientation());
}
}
use of com.taobao.weex.ui.component.WXComponentProp in project incubator-weex by apache.
the class WXRecyclerTemplateList method setScrollDirection.
@WXComponentProp(name = Constants.Name.SCROLL_DIRECTION)
public void setScrollDirection(String direction) {
if (orientation != mDomObject.getOrientation()) {
orientation = mDomObject.getOrientation();
updateRecyclerAttr();
WXRecyclerView wxRecyclerView = getHostView().getInnerView();
wxRecyclerView.initView(getContext(), mLayoutType, mColumnCount, mColumnGap, getOrientation());
}
}
Aggregations