Created
July 19, 2018 08:43
-
-
Save stepango/37eab3fcdf4de015574439e0e717712e to your computer and use it in GitHub Desktop.
Observable fields mapping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val nameText = ObservableBoolean(nameHint) { it.isEmpty() } | |
fun <T: Any> ObservableBoolean(o: ObservableField<T>, f:(T) -> Boolean): ObservableBoolean { | |
return ObservableBoolean() | |
.apply { | |
o.observe { | |
this.set(f(it!!)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment