Search in sources :

Example 1 with WXScroller

use of com.taobao.weex.ui.component.WXScroller in project weex-example by KalicyZhou.

the class WXRenderStatement method createBody.

/**
   * create RootView ,every weex Instance View has a rootView;
   * @see com.taobao.weex.dom.WXDomStatement#createBody(JSONObject)
   */
void createBody(WXComponent component) {
    long start = System.currentTimeMillis();
    component.createView();
    if (WXEnvironment.isApkDebugable()) {
        WXLogUtils.renderPerformanceLog("createView", (System.currentTimeMillis() - start));
    }
    start = System.currentTimeMillis();
    component.applyLayoutAndEvent(component);
    component.bindData(component);
    if (WXEnvironment.isApkDebugable()) {
        WXLogUtils.renderPerformanceLog("bind", (System.currentTimeMillis() - start));
    }
    if (component instanceof WXScroller) {
        WXScroller scroller = (WXScroller) component;
        if (scroller.getInnerView() instanceof ScrollView) {
            mWXSDKInstance.setRootScrollView((ScrollView) scroller.getInnerView());
        }
    }
    mWXSDKInstance.onRootCreated(component);
    if (mWXSDKInstance.getRenderStrategy() != WXRenderStrategy.APPEND_ONCE) {
        mWXSDKInstance.onCreateFinish();
    }
}
Also used : ScrollView(android.widget.ScrollView) WXScroller(com.taobao.weex.ui.component.WXScroller)

Example 2 with WXScroller

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

the class CreateBodyAction method executeRender.

@Override
public void executeRender(RenderActionContext context) {
    WXComponent component = context.getComponent(WXDomObject.ROOT);
    WXSDKInstance instance = context.getInstance();
    if (instance == null || instance.getContext() == null) {
        WXLogUtils.e("instance is null or instance is destroy!");
        mErrMsg.append("instance is null or instance is destroy!");
        return;
    }
    try {
        Stopwatch.tick();
        long start = System.currentTimeMillis();
        component.createView();
        if (WXEnvironment.isApkDebugable()) {
            WXLogUtils.renderPerformanceLog("createView", (System.currentTimeMillis() - start));
            submitPerformance("createView", "X", instance.getInstanceId(), Stopwatch.tackAndTick(), start, true);
        }
        start = System.currentTimeMillis();
        component.applyLayoutAndEvent(component);
        if (WXTracing.isAvailable()) {
            submitPerformance("applyLayoutAndEvent", "X", instance.getInstanceId(), Stopwatch.tackAndTick(), start, true);
        }
        start = System.currentTimeMillis();
        component.bindData(component);
        if (WXEnvironment.isApkDebugable()) {
            WXLogUtils.renderPerformanceLog("bind", (System.currentTimeMillis() - start));
            submitPerformance("bindData", "X", instance.getInstanceId(), Stopwatch.tack(), start, true);
        }
        if (component instanceof WXScroller) {
            WXScroller scroller = (WXScroller) component;
            if (scroller.getInnerView() instanceof ScrollView) {
                instance.setRootScrollView((ScrollView) scroller.getInnerView());
            }
        }
        instance.onRootCreated(component);
        if (instance.getRenderStrategy() != WXRenderStrategy.APPEND_ONCE) {
            instance.onCreateFinish();
        }
        component.mTraceInfo.uiQueueTime = mUIQueueTime;
        component.onRenderFinish(WXComponent.STATE_ALL_FINISH);
    } catch (Exception e) {
        WXLogUtils.e("create body failed.", e);
        mErrMsg.append("create body failed.").append(WXLogUtils.getStackTrace(e)).toString();
    }
}
Also used : WXSDKInstance(com.taobao.weex.WXSDKInstance) WXComponent(com.taobao.weex.ui.component.WXComponent) ScrollView(android.widget.ScrollView) WXScroller(com.taobao.weex.ui.component.WXScroller)

Aggregations

ScrollView (android.widget.ScrollView)2 WXScroller (com.taobao.weex.ui.component.WXScroller)2 WXSDKInstance (com.taobao.weex.WXSDKInstance)1 WXComponent (com.taobao.weex.ui.component.WXComponent)1