Search in sources :

Example 1 with BusSupport

use of com.tmall.wireless.tangram.eventbus.BusSupport in project Tangram-Android by alibaba.

the class SlideCard method switchTo.

@Override
public void switchTo(int index) {
    BusSupport busSupport = serviceManager.getService(BusSupport.class);
    if (busSupport != null) {
        storeCache();
        args.put(KEY_INDEX, String.valueOf(index));
        busSupport.post(BusSupport.obtainEvent("switchTo", null, args, null));
        mIndex = index;
    }
}
Also used : BusSupport(com.tmall.wireless.tangram.eventbus.BusSupport)

Example 2 with BusSupport

use of com.tmall.wireless.tangram.eventbus.BusSupport 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();
    }
    BusSupport busSupport = getService(BusSupport.class);
    if (busSupport != null) {
        busSupport.shutdown();
    }
    VafContext vafContext = getService(VafContext.class);
    if (vafContext != null) {
        vafContext.onDestroy();
    }
}
Also used : VafContext(com.tmall.wireless.vaf.framework.VafContext) TimerSupport(com.tmall.wireless.tangram.support.TimerSupport) BusSupport(com.tmall.wireless.tangram.eventbus.BusSupport)

Example 3 with BusSupport

use of com.tmall.wireless.tangram.eventbus.BusSupport in project Tangram-Android by alibaba.

the class SlideCard method onAdded.

@Override
protected void onAdded() {
    super.onAdded();
    BusSupport busSupport = serviceManager.getService(BusSupport.class);
    if (busSupport != null) {
        busSupport.register(mSetMeta);
    }
}
Also used : BusSupport(com.tmall.wireless.tangram.eventbus.BusSupport)

Example 4 with BusSupport

use of com.tmall.wireless.tangram.eventbus.BusSupport in project Tangram-Android by alibaba.

the class SlideCard method onRemoved.

@Override
protected void onRemoved() {
    super.onRemoved();
    BusSupport busSupport = serviceManager.getService(BusSupport.class);
    if (busSupport != null) {
        busSupport.unregister(mSetMeta);
    }
}
Also used : BusSupport(com.tmall.wireless.tangram.eventbus.BusSupport)

Example 5 with BusSupport

use of com.tmall.wireless.tangram.eventbus.BusSupport in project Tangram-Android by alibaba.

the class BannerView method onPageSelected.

@Override
public void onPageSelected(int position) {
    currentItemPos = mUltraViewPager.getCurrentItem();
    mIndicator.setCurrItem(currentItemPos);
    if (cell != null && cell.extras != null) {
        try {
            cell.extras.put(CURRENT_POS, currentItemPos);
        } catch (JSONException e) {
        }
    }
    if (bannerSupport != null) {
        for (int j = 0; j < bannerSupport.getListeners().size(); j++) {
            BannerListener listener = bannerSupport.getListeners().get(j);
            listener.onPageSelected(currentItemPos);
        }
    }
    if (cell != null && cell.serviceManager != null) {
        BusSupport busSupport = cell.serviceManager.getService(BusSupport.class);
        if (busSupport != null) {
            EventContext eventContext = new EventContext();
            if (((BannerCell) cell).mCells != null && currentItemPos >= 0 && currentItemPos < ((BannerCell) cell).mCells.size()) {
                eventContext.producer = ((BannerCell) cell).mCells.get(currentItemPos);
            }
            busSupport.post(BusSupport.obtainEvent(BusSupport.EVENT_ON_EXPOSURE, cell.id, null, eventContext));
        }
    }
}
Also used : EventContext(com.tmall.wireless.tangram.eventbus.EventContext) BannerCell(com.tmall.wireless.tangram.structure.cell.BannerCell) BannerListener(com.tmall.wireless.tangram.ext.BannerListener) BusSupport(com.tmall.wireless.tangram.eventbus.BusSupport) JSONException(org.json.JSONException)

Aggregations

BusSupport (com.tmall.wireless.tangram.eventbus.BusSupport)7 ArrayMap (android.support.v4.util.ArrayMap)2 EventContext (com.tmall.wireless.tangram.eventbus.EventContext)1 BannerListener (com.tmall.wireless.tangram.ext.BannerListener)1 BannerCell (com.tmall.wireless.tangram.structure.cell.BannerCell)1 TimerSupport (com.tmall.wireless.tangram.support.TimerSupport)1 VafContext (com.tmall.wireless.vaf.framework.VafContext)1 JSONException (org.json.JSONException)1