package com.app.baselibrary.commonUtil;

/**
 * Created by xucon on 2016/11/22.
 */

public class ControlUtil {

    private static long lastClickTime;

    private static long  intervalTime = 1000;
    /**
     * 控制重复点击
     * @return
     */
    public static boolean isRepeatClick() {
        long time = System.currentTimeMillis();
        long timeD = time - lastClickTime;
        if ( 0 < timeD && timeD < intervalTime) {
            return true;
        }
        lastClickTime = time;
        return false;
    }

    /**
     * 控制重复点击
     * @return
     */
    public static boolean isRepeatClick(long intervalTime) {
        long time = System.currentTimeMillis();
        long timeD = time - lastClickTime;
        if ( 0 < timeD && timeD < intervalTime) {
            return true;
        }
        lastClickTime = time;
        return false;
    }
}
