Search in sources :

Example 1 with ClickExposureCellOp

use of com.tmall.wireless.tangram.op.ClickExposureCellOp in project Tangram-Android by alibaba.

the class RxExposureSupportTest method testDestroyExposure.

@Test
@SmallTest
@UiThreadTest
public void testDestroyExposure() {
    ExposureSupport exposureSupport = new ExposureSupport() {

        private CompositeDisposable mCompositeDisposable = new CompositeDisposable();

        Consumer<ClickExposureCellOp> consumer = new Consumer<ClickExposureCellOp>() {

            @Override
            public void accept(ClickExposureCellOp clickEvent) throws Exception {
                // should not execute here
                assertTrue(false);
                assertTrue(Looper.myLooper() == Looper.getMainLooper());
                assertEquals(clickEvent.getArg1(), mView1);
                assertEquals(clickEvent.getArg2(), mBaseCell1);
                assertEquals(clickEvent.getArg3().intValue(), 10);
                Log.d("RxExposureSupportTest", "testExposureTaskAsyncThenCancelItButResubscribe  mEventType " + clickEvent.getArg3());
                Log.d("RxExposureSupportTest", "testDestroyExposure  thread " + Thread.currentThread().getId() + ": " + Thread.currentThread().getName());
            }
        };

        @Override
        public void onExposure(@NonNull Card card, int offset, int position) {
        }
    };
    mServiceManager.register(ExposureSupport.class, exposureSupport);
    mBaseCell1.exposure(mView1);
    mBaseCell1.exposure(mView1);
    exposureSupport.destroy();
}
Also used : ExposureSupport(com.tmall.wireless.tangram.support.ExposureSupport) Consumer(io.reactivex.functions.Consumer) NonNull(android.support.annotation.NonNull) ClickExposureCellOp(com.tmall.wireless.tangram.op.ClickExposureCellOp) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Card(com.tmall.wireless.tangram.dataparser.concrete.Card) SmallTest(android.support.test.filters.SmallTest) UiThreadTest(android.support.test.annotation.UiThreadTest) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest) UiThreadTest(android.support.test.annotation.UiThreadTest)

Example 2 with ClickExposureCellOp

use of com.tmall.wireless.tangram.op.ClickExposureCellOp in project Tangram-Android by alibaba.

the class BaseCell method exposure.

/**
 * @param targetView
 * @since 3.0.0
 */
public CellExposureObservable exposure(View targetView) {
    ClickExposureCellOp rxExposureEvent = mRxExposureEvents.get(targetView);
    if (rxExposureEvent == null) {
        rxExposureEvent = new ClickExposureCellOp(targetView, this, this.pos);
        mRxExposureEvents.put(targetView, rxExposureEvent);
    } else {
        rxExposureEvent.setArg1(targetView);
        rxExposureEvent.setArg2(this);
        rxExposureEvent.setArg3(this.pos);
    }
    return exposure(targetView, rxExposureEvent);
}
Also used : ClickExposureCellOp(com.tmall.wireless.tangram.op.ClickExposureCellOp)

Example 3 with ClickExposureCellOp

use of com.tmall.wireless.tangram.op.ClickExposureCellOp in project Tangram-Android by alibaba.

the class BaseCell method click.

/**
 * @param view
 * @since 3.0.0
 */
public CellClickObservable click(View view) {
    ClickExposureCellOp rxClickEvent = mRxClickEvents.get(view);
    if (rxClickEvent == null) {
        rxClickEvent = new ClickExposureCellOp(view, this, this.pos);
        mRxClickEvents.put(view, rxClickEvent);
    } else {
        rxClickEvent.setArg1(view);
        rxClickEvent.setArg2(this);
        rxClickEvent.setArg3(this.pos);
    }
    return click(view, rxClickEvent);
}
Also used : ClickExposureCellOp(com.tmall.wireless.tangram.op.ClickExposureCellOp)

Aggregations

ClickExposureCellOp (com.tmall.wireless.tangram.op.ClickExposureCellOp)3 NonNull (android.support.annotation.NonNull)1 UiThreadTest (android.support.test.annotation.UiThreadTest)1 SmallTest (android.support.test.filters.SmallTest)1 Card (com.tmall.wireless.tangram.dataparser.concrete.Card)1 ExposureSupport (com.tmall.wireless.tangram.support.ExposureSupport)1 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)1 Consumer (io.reactivex.functions.Consumer)1 Test (org.junit.Test)1