package com.swago.baseswago.util

import android.view.View

/**
 *@date 2021/11/20 11:57
 *description:
 */
abstract class NoDoubleClickListener : View.OnClickListener{

    companion object{
        const val delayTime = 500
    }

    var lastClickTime = 0L
    override fun onClick(v: View?) {
        val curTime = System.currentTimeMillis()
        if (curTime - lastClickTime > delayTime){
            lastClickTime = curTime
            onClick()
        }

    }


    abstract fun onClick()
}