Skip to content

Instantly share code, notes, and snippets.

@OssamaDroid
Created February 10, 2020 00:14
Show Gist options
  • Save OssamaDroid/e9dd206e0a9db87ecc0992d0fd5115a7 to your computer and use it in GitHub Desktop.
Save OssamaDroid/e9dd206e0a9db87ecc0992d0fd5115a7 to your computer and use it in GitHub Desktop.
// Create Observable for button clicks
val submitEvents: Observable<SubmitEvent> =
submit_btn.clicks()
.map { SubmitEvent(edit_text.text.toString()) }
// Create Observable for text typing
val checkNameEvents: Observable<CheckNameEvent> =
edit_text.afterTextChangeEvents()
.map { CheckNameEvent(it.editable?.toString()) }
// Merged events
val events: Observable<UIEvent> = Observable.merge(submitEvents, checkNameEvents)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment