This module contains different extensions and utilities for RxJava
Contains extension functions for RxJava.
Sample:
getSuggestedFriendsUseCase.execute(EXAMPLE_ID)
.zipWithTimer(DELAY)
.bindProgress(progressConsumer)
.applySchedulers(IoToMainSchedulersFacede())
.doOnSuccess { toast(it.toString()) }
.toObservable()Contains classes that implements SchedulersFacade to work with basic schedulers,
such as Schedulers.computation(), Schedulers.io(), AndroidSchedulers.mainThread().
SchedulersFacade - helper interface that provides access of client code to Schedulers.
Contains properties subscribeOn and observeOn that can be used with reactive data sources:
Observable, Flowable, Single and Completable.
This class designed to work with one of applySchedulers(schedulersFacade: SchedulersFacade)functions,
which implemented in RxExtensions
SimpleEVENT BUSbuilt in a reactive manner. Provides publish-subscribe-style communication between components.
This class build aboveRxRelay.
Can be used in two ways: with key or not. For each new key new Relay will be created.
Without key all events will be posted in in general Relay. The same behaviour if use Keys.GENERAL.
Usage of this class is thread safe.
Use key based relays to split logic in your application.
Or you can use keys specified in Keys to access some specific relays, provided with this class.
To get more information about this relays read documentation of Keys
For correct work of bus, you need to post events and subscribe
to receive them, on the same instance of RxBus. The best usage is Singleton pattern.
You can implement singleton bus provider by yourself, or use our SingletonRxBusProvider
Posting Events:
SingletonRxBusProvider.BUS.post(event = SomeEventClass())or
SingletonRxBusProvider.BUS.post(TypeOfYourEvent::class.java, SomeEventClass()) // you can use any type/class/object for event typeor
SingletonRxBusProvider.BUS.post(RxBus.Keys.SINGLE, SomeEventClass()) // to use SingleSubscriberRelay as events busReceiving Events
SingletonRxBusProvider.BUS.observable()
.subscribe{// your code here}or
SingletonRxBusProvider.BUS.observable(TypeOfYourEvent::class.java)
.subscribe{// your code here}For full list of functions, please look to the source code,example project or view documentation