Search in sources :

Example 1 with CellSupport

use of com.tmall.wireless.tangram.support.CellSupport in project Tangram-Android by alibaba.

the class MVHelper method mountView.

public void mountView(BaseCell cell, View view) {
    try {
        mvResolver.register(getCellUniqueId(cell), cell, view);
        if (cell.serviceManager != null) {
            CellSupport cellSupport = cell.serviceManager.getService(CellSupport.class);
            if (cellSupport != null) {
                cellSupport.bindView(cell, view);
            }
        }
        if (view instanceof IContainer) {
            ViewBase vb = ((IContainer) view).getVirtualView();
            vb.setVData(cell.extras);
            if (vb.supportExposure()) {
                VafContext context = cell.serviceManager.getService(VafContext.class);
                context.getEventManager().emitEvent(EventManager.TYPE_Exposure, EventData.obtainData(context, vb));
            }
            renderStyle(cell, view);
        } else {
            loadMethod(cell, view);
            initView(cell, view);
            renderView(cell, view);
            renderStyle(cell, view);
        }
        if (resolver().isCompatibleType(cell.stringType)) {
            resolver().getCellClass(cell.stringType).cast(cell).bindView(view);
        }
        postMountView(cell, view);
        if (cell.serviceManager != null) {
            CellSupport cellSupport = cell.serviceManager.getService(CellSupport.class);
            if (cellSupport != null) {
                cellSupport.postBindView(cell, view);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        if (cell.serviceManager != null) {
            CellSupport cellSupport = cell.serviceManager.getService(CellSupport.class);
            if (cellSupport != null) {
                cellSupport.onBindViewException(cell, view, e);
            }
        }
    }
}
Also used : CellSupport(com.tmall.wireless.tangram.support.CellSupport) VafContext(com.tmall.wireless.vaf.framework.VafContext) IContainer(com.tmall.wireless.vaf.virtualview.core.IContainer) ViewBase(com.tmall.wireless.vaf.virtualview.core.ViewBase)

Example 2 with CellSupport

use of com.tmall.wireless.tangram.support.CellSupport in project Tangram-Android by alibaba.

the class MVHelper method unMountView.

public void unMountView(BaseCell cell, View view) {
    if (view instanceof IContainer) {
        ViewBase vb = ((IContainer) view).getVirtualView();
        vb.reset();
    }
    postUnMountView(cell, view);
    if (cell.serviceManager != null) {
        CellSupport cellSupport = cell.serviceManager.getService(CellSupport.class);
        if (cellSupport != null) {
            cellSupport.unBindView(cell, view);
        }
    }
    if (resolver().isCompatibleType(cell.stringType)) {
        resolver().getCellClass(cell.stringType).cast(cell).unbindView(view);
    }
}
Also used : CellSupport(com.tmall.wireless.tangram.support.CellSupport) IContainer(com.tmall.wireless.vaf.virtualview.core.IContainer) ViewBase(com.tmall.wireless.vaf.virtualview.core.ViewBase)

Aggregations

CellSupport (com.tmall.wireless.tangram.support.CellSupport)2 IContainer (com.tmall.wireless.vaf.virtualview.core.IContainer)2 ViewBase (com.tmall.wireless.vaf.virtualview.core.ViewBase)2 VafContext (com.tmall.wireless.vaf.framework.VafContext)1