use of io.reactivex.disposables.CompositeDisposable in project RxJava-Android-Samples by kaushikgopal.
the class RxBusDemo_Bottom2Fragment method onStart.
@Override
public void onStart() {
super.onStart();
_disposables = new CompositeDisposable();
Flowable<Object> tapEventEmitter = _rxBus.asFlowable().share();
_disposables.add(tapEventEmitter.subscribe(event -> {
if (event instanceof RxBusDemoFragment.TapEvent) {
_showTapText();
}
}));
Flowable<Object> debouncedEmitter = tapEventEmitter.debounce(1, TimeUnit.SECONDS);
Flowable<List<Object>> debouncedBufferEmitter = tapEventEmitter.buffer(debouncedEmitter);
_disposables.add(debouncedBufferEmitter.observeOn(AndroidSchedulers.mainThread()).subscribe(taps -> {
_showTapCount(taps.size());
}));
}
use of io.reactivex.disposables.CompositeDisposable in project BaseProject by fly803.
the class RxBus method unregister.
public void unregister(@NonNull Object observer) {
ObjectHelper.requireNonNull(observer, "Observer to unregister must not be null.");
CompositeDisposable composite = OBSERVERS.get(observer.getClass());
ObjectHelper.requireNonNull(composite, "Missing observer, it was registered?");
composite.dispose();
OBSERVERS.remove(observer.getClass());
Set<CustomSubscriber<?>> subscribers = SUBSCRIBERS.get(observer.getClass());
if (subscribers != null) {
subscribers.clear();
SUBSCRIBERS.remove(observer.getClass());
}
}
use of io.reactivex.disposables.CompositeDisposable in project seven_develop by seven123456.
the class RxLifeManager method setCompositeDisposableOnStop.
public void setCompositeDisposableOnStop(@NonNull Disposable s) {
if (compositeDisposableOnStop != null) {
compositeDisposableOnStop.add(s);
} else {
compositeDisposableOnStop = new CompositeDisposable();
compositeDisposableOnStop.add(s);
}
}
Aggregations