RxT4A - RxJava Toolbox for Android
// AndroidSchedulers
Scheduler scheduler = AndroidSchedulers.mainThread();
Scheduler scheduler = AndroidSchedulers.from(new Handler());
// AndroidCompositeSubscription
final AndroidCompositeSubscription s = new AndroidCompositeSubscription();
s.add(subscription1);
s.add(subscription2);
s.unsubscribe(); // unsubscribe 1 and 2
// it is reusable!
s.add(subscription3);
s.add(subscription4);
s.unsubscribe(); // unsubscribe 3 and 4, too!
// OperatorAddToCompositeSubscription
Observable.just("foo")
.lift(new OperatorAddToCompositeSubscription<String>(s))
.delay(5, TimeUnit.MILLISECONDS)
.subscribe(...);
s.unsubscribe(); // unsubscribe the above subscription
This is a fork of RxAndroid.
This is almost the same as RxAndroid's AndroidSchedulers
.
This is a variation of CompositeSubscription
but can be reused multiple times.
Add a subscription to AndroidCompositeSubscription
in operator chains.
This class provides a way to create subscriptions for Android applications.
Subscription subscription = observable.subscribe(subscriber);
// Like Subscriptions.create(Action0), but the action is called on the main thread.
subscription.add(AndroidSubscriptions.unsubscribeOnMainThread(new Action0() {
@Override
public void call() {
// You can touch touch views.
}
}));
dependencies {
compile 'com.cookpad.android.rxt4a:rxt4a:1.0.0'
}
The MIT License
Cookpad Inc.