Created
July 20, 2012 05:39
-
-
Save aybabtme/3148899 to your computer and use it in GitHub Desktop.
Idea how to expire gesture steps - in pseudo-pseudo C#/Java code
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
// Member objects | |
mTimerTask = new Task(){ | |
mIsTrackingGesture = false; | |
}; | |
mIsTrackingGesture = false; | |
// In the frame_ready | |
mGestureDetector.detectBeginGesture(); | |
if (mGestureDetector.beginningDetected() ) | |
{ | |
// Detected a possible gesture | |
somehowSetIsTrackIngToTrue(); | |
// Start counting down the expiration | |
TaskSchedule aSchedule = new TaskSchedule(); | |
aSchedule.registerTask(mTimerTask, inDelaySeconds); | |
if( mGestureDetector.detectMidGesture() && mIsTrackingGesture ) { | |
// Cancel the expiration | |
aSchedule.cancelTask(mTimerTask); | |
// Register the expiration again until next gesture key is | |
// reached | |
aSchedule.registerTask(mTimerTask, inDelaySeconds); | |
if( mGestureDetector.detectEndGesture() && mIsTrackingGesture ){ | |
// Gesture detected !! You win | |
doSomething() | |
// Clean-up back to normal state | |
aSchedule.removeAllTask(); | |
mIsTrackingGesture = false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment