Search in sources :

Example 6 with WXComponentProp

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();
    }
}
Also used : EditText(android.widget.EditText) Field(java.lang.reflect.Field) Drawable(android.graphics.drawable.Drawable) WXDomObject(com.taobao.weex.dom.WXDomObject) WXComponentProp(com.taobao.weex.ui.component.WXComponentProp)

Example 7 with WXComponentProp

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);
    }
}
Also used : WXSDKInstance(com.taobao.weex.WXSDKInstance) ImageView(android.widget.ImageView) HookWXImageView(com.eros.framework.extend.hook.ui.view.HookWXImageView) Uri(android.net.Uri) WXComponentProp(com.taobao.weex.ui.component.WXComponentProp)

Example 8 with WXComponentProp

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());
    }
}
Also used : WXRecyclerView(com.taobao.weex.ui.view.listview.WXRecyclerView) WXComponentProp(com.taobao.weex.ui.component.WXComponentProp)

Example 9 with WXComponentProp

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());
    }
}
Also used : WXRecyclerView(com.taobao.weex.ui.view.listview.WXRecyclerView) WXComponentProp(com.taobao.weex.ui.component.WXComponentProp)

Example 10 with WXComponentProp

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());
    }
}
Also used : WXRecyclerView(com.taobao.weex.ui.view.listview.WXRecyclerView) WXComponentProp(com.taobao.weex.ui.component.WXComponentProp)

Aggregations

WXComponentProp (com.taobao.weex.ui.component.WXComponentProp)29 WXRecyclerView (com.taobao.weex.ui.view.listview.WXRecyclerView)13 Calendar (java.util.Calendar)4 HookBounceScrollerView (com.eros.framework.extend.hook.ui.view.HookBounceScrollerView)3 Drawable (android.graphics.drawable.Drawable)2 Uri (android.net.Uri)2 SpannableString (android.text.SpannableString)2 URLSpan (android.text.style.URLSpan)2 Pair (android.util.Pair)2 EditText (android.widget.EditText)2 TextView (android.widget.TextView)2 HookWXHorizontalScrollView (com.eros.framework.extend.hook.ui.view.HookWXHorizontalScrollView)2 JSMethod (com.taobao.weex.annotation.JSMethod)2 Invoker (com.taobao.weex.bridge.Invoker)2 MethodInvoker (com.taobao.weex.bridge.MethodInvoker)2 WXDomObject (com.taobao.weex.dom.WXDomObject)2 WXHorizontalScrollView (com.taobao.weex.ui.view.WXHorizontalScrollView)2 Annotation (java.lang.annotation.Annotation)2 Field (java.lang.reflect.Field)2 Method (java.lang.reflect.Method)2