Skip to content

Instantly share code, notes, and snippets.

@rohmanhakim
Created January 4, 2017 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rohmanhakim/4c1b554c3a7fb2493029cb99d8b17662 to your computer and use it in GitHub Desktop.
Save rohmanhakim/4c1b554c3a7fb2493029cb99d8b17662 to your computer and use it in GitHub Desktop.
Observable<Boolean> emptyFieldStream = Observable.combineLatest(
RxTextView.textChanges(etEmail)
.map(new Func1<CharSequence, Boolean>() {
@Override
public Boolean call(CharSequence charSequence) {
return TextUtils.isEmpty(charSequence);
}
}),
RxTextView.textChanges(etPassword)
.map(new Func1<CharSequence, Boolean>() {
@Override
public Boolean call(CharSequence charSequence) {
return TextUtils.isEmpty(charSequence);
}
}),
RxTextView.textChanges(etPasswordConfirmation)
.map(new Func1<CharSequence, Boolean>() {
@Override
public Boolean call(CharSequence charSequence) {
return TextUtils.isEmpty(charSequence);
}
}),
new Func3<Boolean, Boolean, Boolean, Boolean>() {
@Override
public Boolean call(Boolean emailEmpty, Boolean passwordEmpty, Boolean passwordConfirmationEmpty) {
return emailEmpty || passwordEmpty || passwordConfirmationEmpty;
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment