Skip to content

Instantly share code, notes, and snippets.

@theerasan
Created July 11, 2017 17:01
Show Gist options
  • Select an option

  • Save theerasan/c064a74ac2d7c31bbc6ad738180df337 to your computer and use it in GitHub Desktop.

Select an option

Save theerasan/c064a74ac2d7c31bbc6ad738180df337 to your computer and use it in GitHub Desktop.
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initView()
initViewModel()
initPresenter()
initEvent()
}
.
.
.
private fun initEvent() {
val emailWatcher = object: TextWatcher {
override fun afterTextChanged(s: Editable?) {
}
override fun beforeTextChanged(s: CharSequence?,
start: Int,
count: Int,
after: Int) {
}
override fun onTextChanged(s: CharSequence?,
start: Int,
before: Int,
count: Int) {
presenter?.onEmailUpdate(s.toString())
}
}
val passwordWatcher = object: TextWatcher {
override fun afterTextChanged(s: Editable?) {
}
override fun beforeTextChanged(s: CharSequence?,
start: Int,
count: Int,
after: Int) {
}
override fun onTextChanged(s: CharSequence?,
start: Int,
before: Int,
count: Int) {
presenter?.onPasswordUpdate(s.toString())
}
}
binding?.email?.addTextChangedListener(emailWatcher)
binding?.password?.addTextChangedListener(passwordWatcher)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment