Skip to content

Instantly share code, notes, and snippets.

@aybabtme
Created July 20, 2012 05:39
Show Gist options
  • Save aybabtme/3148899 to your computer and use it in GitHub Desktop.
Save aybabtme/3148899 to your computer and use it in GitHub Desktop.
Idea how to expire gesture steps - in pseudo-pseudo C#/Java code
// 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