- Creating
- Create
- Empty
- FromCallable
- FromList
- Just
- Never
- Range
- Transforming
- Buffer
- ConcatMap
- FlatMap
- Map
- SwitchMap
- Filtering
- Distinct
- Filter
- TakeLast
- Combining
- CombineLatest
- Concat
- Merge
- Zip
- Utility
- DoOnNext
- DoOnSubscribe
- ObserveOn
- SubscrubeOn
- Subjects
- AsyncSubject
- BehaviorSubject
- PublishSubject
- ReplaySubject
Gradle:
repositories {
jcenter()
}
dependencies {
implementation 'com.dvpermyakov:rx-kotlin:0.1.2'
}
Example:
class TransactionInteractor {
private val cardRepository = CardRepository()
private val transactionRepository = TransactionRepository()
fun getAllTransactions(): Observable<Transaction> {
return Observable.concatList(
listOf(
cardRepository.getMyCards().subscribeOn(ThreadScheduler()),
cardRepository.getOtherCards().subscribeOn(ThreadScheduler())
)
)
.doOnNext { Log.e(TAG, "card = $it") }
.switchMap { card ->
transactionRepository.getTransactions(card)
.subscribeOn(ThreadScheduler())
.doOnNext { Log.e(TAG, "transaction = $it for card = ${card.id}") }
}
}
companion object {
private const val TAG = "TransactionInteractor"
}
}