src/de/voidplus/leapmotion/LeapMotion.java
/**
     * Activate gesture recognition.
     *
     * @param names List of gestures (e.g. "swipe, circle, screen_tap, key_tap")
     * @return LeapMotion
     */
Activate gesture recognition.
@param names List of gestures
@return LeapMotion
Activate gesture recognition . @param names List of gestures @return LeapMotion
public LeapMotion withGestures(String names) {
        names = names.trim().toUpperCase();
        List<String> gestures = Arrays.asList(names.split("\\s*,\\s*"));
        this.recognition = false;
        for (String gesture : gestures) {
            gesture = "TYPE_" + gesture;
            this.recognition = true;
            switch (com.leapmotion.leap.Gesture.Type.valueOf(gesture)) {
                case TYPE_SWIPE:
                    controller.enableGesture(Gesture.Type.TYPE_SWIPE);
                    break;
                case TYPE_CIRCLE:
                    controller.enableGesture(Gesture.Type.TYPE_CIRCLE);
                    break;
                case TYPE_SCREEN_TAP:
                    controller.enableGesture(Gesture.Type.TYPE_SCREEN_TAP);
                    break;
                case TYPE_KEY_TAP:
                    controller.enableGesture(Gesture.Type.TYPE_KEY_TAP);
                    break;
                default:
                    this.recognition = false;
                    break;
            }
        }
        if (this.recognition) {
            this.parent.registerMethod("pre", this);
        } else {
            this.parent.unregisterMethod("pre", this);
        }
        return this;
    }
public LeapMotion withGestures ( String names ) { names = names . trim ( ) . toUpperCase ( ) ; List < String > gestures = Arrays . asList ( names . split ( "\\s*,\\s*" ) ) ; this . recognition = false ; for ( String gesture : gestures ) { gesture = "TYPE_" + gesture ; this . recognition = true ; switch ( com . leapmotion . leap . Gesture . Type . valueOf ( gesture ) ) { case TYPE_SWIPE : controller . enableGesture ( Gesture . Type . TYPE_SWIPE ) ; break ; case TYPE_CIRCLE : controller . enableGesture ( Gesture . Type . TYPE_CIRCLE ) ; break ; case TYPE_SCREEN_TAP : controller . enableGesture ( Gesture . Type . TYPE_SCREEN_TAP ) ; break ; case TYPE_KEY_TAP : controller . enableGesture ( Gesture . Type . TYPE_KEY_TAP ) ; break ; default : this . recognition = false ; break ; } } if ( this . recognition ) { this . parent . registerMethod ( "pre" , this ) ; } else { this . parent . unregisterMethod ( "pre" , this ) ; } return this ; }
Activate gesture recognition.
Activate gesture recognition .