igorbiscanin
09/07/2017, 9:27 AMError:(114, 36) None of the following functions can be called with the arguments supplied:
@CheckReturnValue @SchedulerSupport public final fun <T1 : Any!, T2 : Any!, R : Any!> combineLatest(p0: ((Observer<in String!>) -> Unit)!, p1: ((Observer<in String!>) -> Unit)!, p2: ((String, String) -> Boolean)!): Observable<Boolean!>! defined in io.reactivex.Observable
@CheckReturnValue @SchedulerSupport public final fun <T : Any!, R : Any!> combineLatest(p0: ((Array<(out) Any!>) -> ???)!, p1: Int, p2: Array<(out) ObservableSource<out (???..???)>!>!): Observable<(???..???)>! defined in io.reactivex.Observable
@CheckReturnValue @SchedulerSupport public open fun <T1 : Any!, T2 : Any!, R : Any!> combineLatest(p0: ObservableSource<out (???..???)>!, p1: ObservableSource<out (???..???)>!, p2: BiFunction<in (???..???), in (???..???), out (???..???)>!): Observable<(???..???)>! defined in io.reactivex.Observable
@CheckReturnValue @SchedulerSupport public open fun <T : Any!, R : Any!> combineLatest(p0: Function<in Array<(out) Any!>!, out (???..???)>!, p1: Int, vararg p2: ObservableSource<out (???..???)>!): Observable<(???..???)>! defined in io.reactivex.Observable
@CheckReturnValue @SchedulerSupport public final fun <T : Any!, R : Any!> combineLatest(p0: Array<(out) ObservableSource<out (???..???)>!>!, p1: ((Array<(out) Any!>) -> ???)!, p2: Int): Observable<(???..???)>! defined in io.reactivex.Observable
@CheckReturnValue @SchedulerSupport public open fun <T : Any!, R : Any!> combineLatest(p0: Array<(out) ObservableSource<out (???..???)>!>!, p1: Function<in Array<(out) Any!>!, out (???..???)>!, p2: Int): Observable<(???..???)>! defined in io.reactivex.Observable
@CheckReturnValue @SchedulerSupport public final fun <T : Any!, R : Any!> combineLatest(p0: (Mutable)Iterable<ObservableSource<out (???..???)>!>!, p1: ((Array<(out) Any!>) -> ???)!, p2: Int): Observable<(???..???)>! defined in io.reactivex.Observable
@CheckReturnValue @SchedulerSupport public open fun <T : Any!, R : Any!> combineLatest(p0: (Mutable)Iterable<ObservableSource<out (???..???)>!>!, p1: Function<in Array<(out) Any!>!, out (???..???)>!, p2: Int): Observable<(???..???)>! defined in io.reactivex.Observable
code sample:
val usernameObservable = RxTextView.textChanges(et_username)
.map { it -> Constants.emailPattern.matcher(it).matches() }
.distinctUntilChanged()
.subscribe()
val passwordObservable = RxTextView.textChanges(et_password)
.map { it -> it.isNotEmpty()}
.distinctUntilChanged()
.subscribe()
val signInEnabledCondition = BiFunction({ username: CharSequence, password: CharSequence ->
username.isNotEmpty() && password.isNotEmpty()
})
val isSignInEnabled = Observable.combineLatest(usernameObservable, passwordObservable, signInEnabledCondition)
isSignInEnabled.distinctUntilChanged().subscribe { enabled: Boolean -> bt_sign_in.isEnabled = enabled }
bamdmux
09/07/2017, 9:54 AMbamdmux
09/07/2017, 9:55 AMigorbiscanin
09/07/2017, 9:58 AMigorbiscanin
09/07/2017, 10:09 AMval usernameObservable: Observable<CharSequence> = RxTextView.textChanges(et_username)
val passwordObservable: Observable<CharSequence> = RxTextView.textChanges(et_password)
val isSignInEnabled = Observable.combineLatest(usernameObservable, passwordObservable, BiFunction<CharSequence, CharSequence, Boolean> { username: CharSequence, password: CharSequence ->
Constants.emailPattern.matcher(username).matches() && username.isNotEmpty() && password.isNotEmpty()
})
isSignInEnabled.distinctUntilChanged().subscribe { enabled: Boolean -> bt_sign_in.isEnabled = enabled }
igorbiscanin
09/07/2017, 10:09 AMigorbiscanin
09/07/2017, 10:09 AM