Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio - How to perform doubleClick in Kotlin? [closed]

A boring thing when some more advanced technologies impose their standards is to have to do with the "double click" to perform an action. But what I'm looking for is an easy way to implement it without having to rewrite the code a thousand times.

I would like to implement double click in my project using Kotlin. Could someone help me? Thanks in Advance

just to know: I would like a way to understand how to do double click or to prevent that user do a doubleclick

like image 486
DoctorWho Avatar asked Dec 22 '22 17:12

DoctorWho


1 Answers

I implemented this library using Kotlin, you can just define the doubleClick property and override single and double click methods, and finally add it to setOnClickListener of your button

val doubleClick = DoubleClick(object : DoubleClickListener {
    override fun onSingleClickEvent(view: View?) {
        // DO STUFF SINGLE CLICK
    }

    override fun onDoubleClickEvent(view: View?) {
       // DO STUFF DOUBLE CLICK
    }
})

button.setOnClickListener(doubleClick)

https://gitlab.com/developerdeveloperdeveloper/androidutilslibrary

like image 126
Barros Avatar answered Dec 28 '22 07:12

Barros