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();
}
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);
}
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);
}
Aggregations