This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class DebugModeTapListener implements View.OnClickListener { | |
private int tapCount = 0; | |
private long lastTap = SystemClock.elapsedRealtime(); | |
@Override | |
public void onClick(final View v) { | |
final Context context = getApplicationContext(); | |
long currentTap = SystemClock.elapsedRealtime(); | |
if (currentTap - lastTap < 500) { | |
tapCount++; | |
} else { | |
tapCount = 1; | |
} | |
lastTap = currentTap; | |
if (tapCount > 10) { | |
// User has tapped 10 times in 5 seconds | |
Toast.makeText(context, "No peeking! ;-)", Toast.LENGTH_SHORT) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment