I am using Rxbinding library for detecting clicks on a textview and textchanges in an editbox. I need to have either a textview clicked or a non-empty editbox and to detect that I am using combinelatest operator on two observables as below:
Observable<Void> obsPriceOnReq = RxView.clicks(vPriceOnReq).asObservable();
obsPriceOnReq.subscribe(new Action1<Void>() {
@Override
public void call(Void aVoid) {
mPriceOnReqBool = !mPriceOnReqBool; // Statement-1
// Do some work here.
});
Observable<String> obsBudget = RxTextView.textChanges(vProjectBudget).map(charseqToStr);
obsBudget.subscribe(new Action1<String>() {
@Override
public void call(String s) {
mBudgetFilledBool = checkPosDouble(s); // Statement-2
}
});
Observable.combineLatest(obsPriceOnReq, obsBudget, new Func2<Void, String, Boolean>() {
@Override
public Boolean call(Void aVoid, String s) {
return mBudgetFilledBool || mPriceOnReqBool; // Statement-3
}
}).subscribe(new Action1<Boolean>() {
@Override
public void call(Boolean aBoolean) {
// Do some work here
}
});
The issue is whenever I click on vPriceOnReq(TextView), Statement-1 is not called but only Statement-3 is called. But whenever I enter text in the vProjectBudget(EditText), Statement-2 as well as Statement-3 are always called. Can someone please help me understand what am I doing wrong here.