Skip to content

Instantly share code, notes, and snippets.

@theerasan
Created July 10, 2017 19:01
Show Gist options
  • Save theerasan/087879c7e38f720434be59497daa473a to your computer and use it in GitHub Desktop.
Save theerasan/087879c7e38f720434be59497daa473a to your computer and use it in GitHub Desktop.
class LoginDataBindingViewModel : BaseObservable() {
@get:Bindable
var email: String? = ""
set(email) {
field = email
notifyPropertyChanged(BR.email)
notifyPropertyChanged(BR.readyToLogin)
}
@get:Bindable
var password: String? = ""
set(password) {
field = password
notifyPropertyChanged(BR.password)
notifyPropertyChanged(BR.readyToLogin)
}
@get:Bindable
var onClickLogin: View.OnClickListener? = null
set(onClickLogin) {
field = onClickLogin
notifyPropertyChanged(BR.onClickLogin)
}
@get:Bindable
var readyToLogin: Boolean? = false
get() {
val notEmptyStrings = TextHelper.isNotEmptyStrings(email, password)
return notEmptyStrings
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment