Skip to content

Instantly share code, notes, and snippets.

@ZaqueuLima3
Created August 10, 2021 15:54
Show Gist options
  • Save ZaqueuLima3/8d1dab9078125c06a548b95b854da60f to your computer and use it in GitHub Desktop.
Save ZaqueuLima3/8d1dab9078125c06a548b95b854da60f to your computer and use it in GitHub Desktop.
handleSingleClick in seOnClickListener
fun View.handleSingleClick(debounceTime: Long = 500L, callback: () -> Unit) {
if (this.isClickable) {
this.isClickable = false
callback()
this.postDelayed(
{
this.isClickable = true
},
debounceTime
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment