rx-observablefield
chuross
11
Visit GitHub RepoData Binding

Rx ObservableField

DataBinding converter library for RxJava2. This Library provide ObservableField to convert RxJava2.

Download

  1. add JitPack repository to your project root build.gradle.
repositories {
    maven { url "https://jitpack.io" }
}
  1. add the dependency latest version:
dependencies {
    compile 'com.github.chuross.rx-observablefield:rxobservablefield:x.x.x'
}
  1. (optional) add the dependency for kotlin:
dependencies {
    compile 'com.github.chuross.rx-observablefield:rxobservablefield-kotlin:x.x.x'
}

Usage

kotlin

val disposables = CompositeDisposables() // RxJava2#CompositeDisposables

...

val hogeField = RxObservableField<String>()

// ObservableField -> Rx#Observable + Operators -> ReadOnlyRxObservableField
val hogeLengthField = hogeField.rx.map { it.length }.filter { it > 10 }.toObservableField(disposables) // ReadOnly!
val hogeLengthField = hogeField.rx.map { it.length }.filter { it > 10 }.toObservableField(disposables, default = 0) // ReadOnly!(with default value)


// get value
hogeField.get() // String?
hogeField.or("fuga") // String
Become a better Android Developer
Millions of developers are learning at MindOrks

Online Training Program

Featured Blogs

Our Team

MindOrks is Certainly one of the best online blog to stay on top of all the Android development news, coding and design patterns. Finally a blog I can count on to keep myself updated with latest and greatest things happening in Android world.

Vipul Shah
Android Developer
Microsoft

Become Pro in Android by watching videos

OUR LEARNERS WORK AT