Created
March 16, 2017 11:09
Revisions
-
rahulmmohan created this gist
Mar 16, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ isUsernameValid.distinctUntilChanged().doOnNext(new Consumer<Boolean>() { @Override public void accept(Boolean valid) throws Exception { Log.d(TAG, "Username " + (valid ? "Valid" : "Invalid")); } }).map(new Function<Boolean, Integer>() { @Override public Integer apply(Boolean valid) throws Exception { return valid?Color.WHITE:Color.RED; } }).subscribe(new Consumer<Integer>() { @Override public void accept(Integer color) throws Exception { mUsernameEditText.setTextColor(color); } }); isEmailValid.distinctUntilChanged().doOnNext(new Consumer<Boolean>() { @Override public void accept(Boolean valid) throws Exception { Log.d(TAG, "Email " + (valid ? "Valid" : "Invalid")); } }).map(new Function<Boolean, Integer>() { @Override public Integer apply(Boolean valid) throws Exception { return valid?Color.WHITE:Color.RED; } }).subscribe(new Consumer<Integer>() { @Override public void accept(Integer color) throws Exception { mEmailEditText.setTextColor(color); } }); registerButtonObservable.distinctUntilChanged().subscribe(new Consumer<Boolean>() { @Override public void accept(Boolean aBoolean) throws Exception { mRegisterButton.setEnabled(aBoolean); } });