Skip to content

Instantly share code, notes, and snippets.

@TheBotBox
Created June 5, 2020 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheBotBox/437b24b1f36e191ca17be4e876966cf5 to your computer and use it in GitHub Desktop.
Save TheBotBox/437b24b1f36e191ca17be4e876966cf5 to your computer and use it in GitHub Desktop.
fun EditText.onDone(callback: (String) -> Unit) {
setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_DONE) {
callback.invoke(text.toString())
true
}
false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment