Search in sources :

Example 1 with ExposureSupport

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

the class MVHelper method postMountView.

private void postMountView(BaseCell cell, View view) {
    if (!cell.mIsExposed && cell.serviceManager != null) {
        ExposureSupport exposureSupport = cell.serviceManager.getService(ExposureSupport.class);
        if (exposureSupport != null) {
            cell.mIsExposed = true;
            exposureSupport.onExposure(view, cell, cell.pos);
        }
    }
    if (view instanceof ITangramViewLifeCycle) {
        ((ITangramViewLifeCycle) view).postBindView(cell);
    } else {
        if (postBindMap.get(cell) != null) {
            try {
                postBindMap.get(cell).invoke(view, cell);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    if (resolver().isCompatibleType(cell.stringType)) {
        resolver().getCellClass(cell.stringType).cast(cell).postBindView(view);
    }
}
Also used : ExposureSupport(com.tmall.wireless.tangram.support.ExposureSupport) ITangramViewLifeCycle(com.tmall.wireless.tangram.structure.view.ITangramViewLifeCycle)

Example 2 with ExposureSupport

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

the class Card method onBindCell.

/**
 * Don't change card's mCells in binding process!
 * <p/>
 */
public void onBindCell(int offset, int position, boolean showFromEnd) {
    if (!mIsExposed && serviceManager != null) {
        ExposureSupport exposureSupport = serviceManager.getService(ExposureSupport.class);
        if (exposureSupport != null) {
            mIsExposed = true;
            exposureSupport.onExposure(this, offset, position);
        }
    }
    if (offset == 0) {
        ExposureSupport exposureSupport = serviceManager.getService(ExposureSupport.class);
        if (exposureSupport != null) {
            exposureSupport.onExposureReaptly(this, offset, position);
        }
    }
}
Also used : ExposureSupport(com.tmall.wireless.tangram.support.ExposureSupport)

Aggregations

ExposureSupport (com.tmall.wireless.tangram.support.ExposureSupport)2 ITangramViewLifeCycle (com.tmall.wireless.tangram.structure.view.ITangramViewLifeCycle)1