collect_app/src/main/java/org/odk/collect/android/application/Collect.java
public static boolean allowClick(String className) {
        long elapsedRealtime = SystemClock.elapsedRealtime();
        boolean isSameClass = className.equals(lastClickName);
        boolean isBeyondThreshold = elapsedRealtime - lastClickTime > CLICK_DEBOUNCE_MS;
        boolean isBeyondTestThreshold = lastClickTime == 0 || lastClickTime == elapsedRealtime; // just for tests
        boolean allowClick = !isSameClass || isBeyondThreshold || isBeyondTestThreshold;
        if (allowClick) {
            lastClickTime = elapsedRealtime;
            lastClickName = className;
        }
        return allowClick;
    }
// Debounce multiple clicks within the same screen
Debounce multiple clicks within the same screen
Debounce multiple clicks within the same screen
public static boolean allowClick(String className) {
        long elapsedRealtime = SystemClock.elapsedRealtime();
        boolean isSameClass = className.equals(lastClickName);
        boolean isBeyondThreshold = elapsedRealtime - lastClickTime > CLICK_DEBOUNCE_MS;
        boolean isBeyondTestThreshold = lastClickTime == 0 || lastClickTime == elapsedRealtime; 
        boolean allowClick = !isSameClass || isBeyondThreshold || isBeyondTestThreshold;
        if (allowClick) {
            lastClickTime = elapsedRealtime;
            lastClickName = className;
        }
        return allowClick;
    }
public static boolean allowClick ( String className ) { long elapsedRealtime = SystemClock . elapsedRealtime ( ) ; boolean isSameClass = className . equals ( lastClickName ) ; boolean isBeyondThreshold = elapsedRealtime - lastClickTime > CLICK_DEBOUNCE_MS ; boolean isBeyondTestThreshold = lastClickTime == 0 || lastClickTime == elapsedRealtime ; boolean allowClick = ! isSameClass || isBeyondThreshold || isBeyondTestThreshold ; if ( allowClick ) { lastClickTime = elapsedRealtime ; lastClickName = className ; } return allowClick ; }
Debounce multiple clicks within the same screen
Debounce multiple clicks within the same screen
// just for tests