Skip to content

Instantly share code, notes, and snippets.

@theerasan
Last active July 12, 2017 07:01
Show Gist options
  • Save theerasan/eec60eb9cb5ad18c3bc250660886cefd to your computer and use it in GitHub Desktop.
Save theerasan/eec60eb9cb5ad18c3bc250660886cefd to your computer and use it in GitHub Desktop.
class LoginArch2WaysBindingViewModel : ViewModel() {
var email: ObservableField<String>? = ObservableField("")
var password: ObservableField<String>? = ObservableField("")
var emailOnChange = TextWatcherAdapter({s ->
email.set(s)
readyToLogin?.set(isCanLogin())
})
var passwordOnChange = TextWatcherAdapter({s ->
password.set(s)
readyToLogin?.set(isCanLogin())
})
var onClickLogin: ObservableField<View.OnClickListener>? = ObservableField()
var readyToLogin: ObservableField<Boolean>? = ObservableField(false)
private fun isCanLogin(): Boolean {
return TextHelper.isNotEmptyStrings(password?.get(), email?.get())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment