Search in sources :

Example 6 with MVHelper

use of com.tmall.wireless.tangram3.MVHelper in project Tangram-Android by alibaba.

the class Card method addCellInternal.

public boolean addCellInternal(@Nullable BaseCell cell, boolean silent) {
    if (cell != null) {
        cell.parentId = id;
        cell.parent = this;
        cell.serviceManager = serviceManager;
        MVHelper mvHelper = getMVHelper();
        if (mvHelper != null) {
            if (mvHelper.isValid(cell, serviceManager)) {
                if (cell.position >= 0 && !TextUtils.isEmpty(load)) {
                    cell.pos = cell.position;
                    mPendingCells.add(cell);
                    return true;
                } else {
                    cell.pos = mHeader != null ? this.mCells.size() + 1 : this.mCells.size();
                }
                if (!silent && mIsActivated) {
                    // do cell added
                    cell.added();
                }
                this.mCells.add(cell);
                if (mFooter != null) {
                    mFooter.pos = cell.pos + 1;
                }
                return true;
            }
        }
    }
    return false;
}
Also used : MVHelper(com.tmall.wireless.tangram3.MVHelper)

Example 7 with MVHelper

use of com.tmall.wireless.tangram3.MVHelper in project Tangram-Android by alibaba.

the class BaseTangramEngine method destroy.

/**
 * Call this when your activity is ready to destory to clear inner resource.
 */
public void destroy() {
    if (mContentView != null) {
        if (mGroupBasicAdapter != null) {
            mGroupBasicAdapter.destroy();
        }
        mContentView.setAdapter(null);
        mContentView = null;
    }
    TimerSupport timerSupport = getService(TimerSupport.class);
    if (timerSupport != null) {
        timerSupport.clear();
    }
    SimpleClickSupport simpleClickSupport = getService(SimpleClickSupport.class);
    if (simpleClickSupport != null) {
        simpleClickSupport.destroy();
    }
    ExposureSupport exposureSupport = getService(ExposureSupport.class);
    if (exposureSupport != null) {
        exposureSupport.destroy();
    }
    BusSupport busSupport = getService(BusSupport.class);
    if (busSupport != null) {
        busSupport.shutdown();
    }
    BannerSupport bannerSupport = getService(BannerSupport.class);
    if (bannerSupport != null) {
        bannerSupport.destroy();
    }
    MVHelper mvHelper = getService(MVHelper.class);
    if (mvHelper != null) {
        mvHelper.renderManager().destroyRenderService();
    }
}
Also used : ExposureSupport(com.tmall.wireless.tangram3.support.ExposureSupport) SimpleClickSupport(com.tmall.wireless.tangram3.support.SimpleClickSupport) TimerSupport(com.tmall.wireless.tangram3.support.TimerSupport) BusSupport(com.tmall.wireless.tangram3.eventbus.BusSupport) BannerSupport(com.tmall.wireless.tangram3.support.BannerSupport)

Aggregations

MVHelper (com.tmall.wireless.tangram3.MVHelper)3 BaseCell (com.tmall.wireless.tangram3.structure.BaseCell)2 NonNull (android.support.annotation.NonNull)1 BaseCellBinderResolver (com.tmall.wireless.tangram3.dataparser.concrete.BaseCellBinderResolver)1 BusSupport (com.tmall.wireless.tangram3.eventbus.BusSupport)1 BannerCard (com.tmall.wireless.tangram3.structure.card.BannerCard)1 FixCard (com.tmall.wireless.tangram3.structure.card.FixCard)1 FixLinearScrollCard (com.tmall.wireless.tangram3.structure.card.FixLinearScrollCard)1 GridCard (com.tmall.wireless.tangram3.structure.card.GridCard)1 LinearScrollCard (com.tmall.wireless.tangram3.structure.card.LinearScrollCard)1 OnePlusNCard (com.tmall.wireless.tangram3.structure.card.OnePlusNCard)1 SlideCard (com.tmall.wireless.tangram3.structure.card.SlideCard)1 StaggeredCard (com.tmall.wireless.tangram3.structure.card.StaggeredCard)1 StickyCard (com.tmall.wireless.tangram3.structure.card.StickyCard)1 StickyEndCard (com.tmall.wireless.tangram3.structure.card.StickyEndCard)1 WrapCellCard (com.tmall.wireless.tangram3.structure.card.WrapCellCard)1 BannerSupport (com.tmall.wireless.tangram3.support.BannerSupport)1 ExposureSupport (com.tmall.wireless.tangram3.support.ExposureSupport)1 SimpleClickSupport (com.tmall.wireless.tangram3.support.SimpleClickSupport)1 TimerSupport (com.tmall.wireless.tangram3.support.TimerSupport)1