Why not use a Switch statement in your handler?
if ( apds.isGestureAvailable() )
switch ( apds.readGesture() )
I wouldn't use a while loop inside your handler... that ties up your microprocessor inside that function and becomes unresponsive to anything else.
A better solution is using interrupts to handle events from your sensor, and just rely on the built in loop() of the program.
It continually loops, when it detects an interrupt from the sensor, process the action, and exit immediately... going back to the main loop().
Now if your want the LEFT or RIGHT button do something different, depending on what "menu" or "mode" the user is in, then look at Finite State Machine programming, i.e. keep track of what state you're in and process the LEFT or RIGHT events depending on what State you're in. You can even move to a new State depending on the action, and quickly exit the loop. On the next loop iteration, you're in the new State and the LEFT/RIGHT buttons/events can function as something else.
Anyways, this is a forum for web development, I think you'll get more help from the Arduino forum. Good luck!