Skip to content

JayantGoel001/Double-Click-Listener

Repository files navigation

Double-Click-Listener

How to

To get a Git project into your build:

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

Step 2. Add the dependency

	dependencies {
	        implementation 'com.github.CormacKrum:Double-Click-Listener:0.1.3'
	}

Basic Usage

The class DoubleClickListener extends from View.OnClickListener so, just call the DoubleClickListener class on your onClickListener of the view that you wish to listen, and pass an object of DoubleClickListener.Callback class to listen the events.You can also add custom time difference betweens click by default is 1000ms.

  • Kotlin
    button.setOnClickListener(
        DoubleClickListener(
            callback = object : DoubleClickListener.Callback {
                override fun doubleClicked() {
                
                }
            },1000
        )
    )
  • Java
    button.setOnClickListener(
        DoubleClickListener(
            object = new DoubleClickListener.Callback {
                override fun doubleClicked() {
                
                }
            },1000
        )
    )

Share this release: