Created
August 10, 2021 15:54
-
-
Save ZaqueuLima3/8d1dab9078125c06a548b95b854da60f to your computer and use it in GitHub Desktop.
handleSingleClick in seOnClickListener
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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