Skip to content

Instantly share code, notes, and snippets.

@tpakis
Last active August 7, 2023 13:19
Show Gist options
  • Save tpakis/508d1a7c15d495cf3345930123d49418 to your computer and use it in GitHub Desktop.
Save tpakis/508d1a7c15d495cf3345930123d49418 to your computer and use it in GitHub Desktop.
fun View.setOnCLick(intervalMillis: Long = 0, doClick: (View) -> Unit) =
setOnClickListener(DebouncingOnClickListener(intervalMillis = intervalMillis, doClick = doClick))
// use it like this
my_button.setOnCLick(intervalMillis = 500) {
// Do stuff
}
// or this
my_button.setOnCLick {
// Do stuff
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment