Search in sources :

Example 1 with BannerListener

use of com.tmall.wireless.tangram.ext.BannerListener 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)

Example 2 with BannerListener

use of com.tmall.wireless.tangram.ext.BannerListener in project Tangram-Android by alibaba.

the class BannerView method onPageScrolled.

@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    if (bannerSupport != null) {
        for (int j = 0; j < bannerSupport.getListeners().size(); j++) {
            BannerListener listener = bannerSupport.getListeners().get(j);
            listener.onPageScrolled(currentItemPos, positionOffset, positionOffsetPixels, direction);
        }
    }
}
Also used : BannerListener(com.tmall.wireless.tangram.ext.BannerListener)

Example 3 with BannerListener

use of com.tmall.wireless.tangram.ext.BannerListener in project Tangram-Android by alibaba.

the class BannerView method onPageScrollStateChanged.

@Override
public void onPageScrollStateChanged(int state) {
    if (bannerSupport != null) {
        for (int j = 0; j < bannerSupport.getListeners().size(); j++) {
            BannerListener listener = bannerSupport.getListeners().get(j);
            listener.onPageScrollStateChanged(state);
        }
    }
}
Also used : BannerListener(com.tmall.wireless.tangram.ext.BannerListener)

Aggregations

BannerListener (com.tmall.wireless.tangram.ext.BannerListener)3 BusSupport (com.tmall.wireless.tangram.eventbus.BusSupport)1 EventContext (com.tmall.wireless.tangram.eventbus.EventContext)1 BannerCell (com.tmall.wireless.tangram.structure.cell.BannerCell)1 JSONException (org.json.JSONException)1