Search in sources :

Example 46 with WXComponent

use of com.taobao.weex.ui.component.WXComponent in project incubator-weex by apache.

the class BasicListComponent method bindViewType.

/**
 * ViewType will be classified into {HashMap<Integer,ArrayList<Integer>> mViewTypes}
 *
 * @param component
 */
private void bindViewType(WXComponent component) {
    int id = generateViewType(component);
    if (mViewTypes == null) {
        mViewTypes = new SparseArray<>();
    }
    ArrayList<WXComponent> mTypes = mViewTypes.get(id);
    if (mTypes == null) {
        mTypes = new ArrayList<>();
        mViewTypes.put(id, mTypes);
    }
    mTypes.add(component);
}
Also used : WXComponent(com.taobao.weex.ui.component.WXComponent) Point(android.graphics.Point)

Example 47 with WXComponent

use of com.taobao.weex.ui.component.WXComponent in project incubator-weex by apache.

the class WXRecyclerTemplateList method doRenderTemplate.

/**
 * create code context for render component and do render
 */
private List<WXComponent> doRenderTemplate(WXCell cell, int position) {
    this.cellRenderContext.clear();
    Object item = cellDataManager.listData.get(position);
    CellRenderState cellRenderState = cellDataManager.getRenderState(position);
    cellRenderContext.renderState = cellRenderState;
    cellRenderContext.templateList = this;
    cellRenderContext.position = position;
    ArrayStack stack = cellRenderContext.stack;
    Map map = cellRenderContext.map;
    if (cellDataManager.listData != null) {
        stack.push(map);
        map.put(listDataKey, cellDataManager.listData);
        if (!TextUtils.isEmpty(listDataIndexKey)) {
            map.put(listDataIndexKey, new PositionRef(cellRenderState));
        }
        if (!TextUtils.isEmpty(listDataItemKey)) {
            map.put(listDataItemKey, item);
        } else {
            stack.push(item);
        }
    }
    if (cellRenderState.itemId <= 0) {
        getItemId(position);
    }
    List<WXComponent> updates = Statements.doRender(cell, this.cellRenderContext);
    if (cellRenderState.isDirty()) {
        cellRenderState.resetDirty();
    }
    return updates;
}
Also used : WXComponent(com.taobao.weex.ui.component.WXComponent) WXDomObject(com.taobao.weex.dom.WXDomObject) JSONObject(com.alibaba.fastjson.JSONObject) WXCellDomObject(com.taobao.weex.dom.WXCellDomObject) WXRecyclerDomObject(com.taobao.weex.dom.WXRecyclerDomObject) ArrayStack(com.taobao.weex.el.parse.ArrayStack) ArrayMap(android.support.v4.util.ArrayMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap)

Example 48 with WXComponent

use of com.taobao.weex.ui.component.WXComponent in project incubator-weex by apache.

the class WXRecyclerTemplateList method bindStickStyle.

@Override
public void bindStickStyle(WXComponent component) {
    WXComponent template = findParentType(component, WXCell.class);
    if (template == null) {
        return;
    }
    if (cellDataManager.listData == null || mStickyHelper == null) {
        return;
    }
    if (!mStickyHelper.getStickyTypes().contains(template.getRef())) {
        mStickyHelper.getStickyTypes().add(template.getRef());
        notifyUpdateList();
    }
}
Also used : WXComponent(com.taobao.weex.ui.component.WXComponent)

Example 49 with WXComponent

use of com.taobao.weex.ui.component.WXComponent in project incubator-weex by apache.

the class ConfigComponentHolder method createInstance.

@Override
public synchronized WXComponent createInstance(WXSDKInstance instance, WXDomObject node, WXVContainer parent) throws IllegalAccessException, InvocationTargetException, InstantiationException {
    if (mClass == null || mClassLoader != instance.getContext().getClassLoader()) {
        mClass = WXSDKManager.getInstance().getClassLoaderAdapter().getComponentClass(mType, mClassName, instance);
        mClassLoader = instance.getContext().getClassLoader();
    }
    ComponentCreator creator = new SimpleComponentHolder.ClazzComponentCreator(mClass);
    WXComponent component = creator.createInstance(instance, node, parent);
    component.bindHolder(this);
    return component;
}
Also used : ComponentCreator(com.taobao.weex.ui.ComponentCreator) WXComponent(com.taobao.weex.ui.component.WXComponent)

Example 50 with WXComponent

use of com.taobao.weex.ui.component.WXComponent in project incubator-weex by apache.

the class FlatGUIContext method getWidgetContainerView.

@Nullable
public View getWidgetContainerView(Widget widget) {
    WXComponent component, ancestor;
    View ret = null;
    if ((component = getComponent(widget)) != null) {
        if ((ancestor = getFlatComponentAncestor(component)) != null) {
            ret = ancestor.getHostView();
        }
    }
    return ret;
}
Also used : WXComponent(com.taobao.weex.ui.component.WXComponent) View(android.view.View) Nullable(android.support.annotation.Nullable)

Aggregations

WXComponent (com.taobao.weex.ui.component.WXComponent)101 Point (android.graphics.Point)21 WXDomObject (com.taobao.weex.dom.WXDomObject)20 WXVContainer (com.taobao.weex.ui.component.WXVContainer)19 HashMap (java.util.HashMap)13 View (android.view.View)9 WXSDKInstanceTest (com.taobao.weex.WXSDKInstanceTest)9 WXRecyclerView (com.taobao.weex.ui.view.listview.WXRecyclerView)9 Map (java.util.Map)9 Test (org.junit.Test)9 ArrayMap (android.support.v4.util.ArrayMap)8 RecyclerView (android.support.v7.widget.RecyclerView)8 JSONObject (com.alibaba.fastjson.JSONObject)8 WXSDKInstance (com.taobao.weex.WXSDKInstance)8 ComponentTest (com.taobao.weex.ui.component.ComponentTest)8 WXDivTest (com.taobao.weex.ui.component.WXDivTest)8 Scrollable (com.taobao.weex.ui.component.Scrollable)6 WXBaseRefresh (com.taobao.weex.ui.component.WXBaseRefresh)6 WXHeaderTest (com.taobao.weex.ui.component.WXHeaderTest)6 AppearanceHelper (com.taobao.weex.ui.component.AppearanceHelper)5