Last active
October 13, 2017 12:00
-
-
Save chetdeva/2c3d0696b39b8bcad00d91f5aa9b662a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| public class LoginModel extends BaseObservable { | |
| private String email; | |
| private String password; | |
| private boolean loginEnabled; | |
| @Bindable | |
| public String getEmail() { | |
| return email; | |
| } | |
| public void setEmail(String email) { | |
| this.email = email; | |
| notifyPropertyChanged(BR.email); | |
| setLoginEnabled(isEmailAndPasswordSet()); | |
| } | |
| @Bindable | |
| public String getPassword() { | |
| return password; | |
| } | |
| public void setPassword(String password) { | |
| this.password = password; | |
| notifyPropertyChanged(BR.password); | |
| setLoginEnabled(isEmailAndPasswordSet()); | |
| } | |
| @Bindable | |
| public boolean isLoginEnabled() { | |
| return loginEnabled; | |
| } | |
| public void setLoginEnabled(boolean loginEnabled) { | |
| this.loginEnabled = loginEnabled; | |
| notifyPropertyChanged(BR.loginEnabled); | |
| } | |
| private boolean isEmailAndPasswordSet() { | |
| return !TextUtils.isEmpty(getEmail()) && !TextUtils.isEmpty(getPassword()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment