Code example for GestureLibrary

Methods: recognize

0
 
    public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
        if (!((LiqoidApplication) getApplication()).getGlobalPreferences().getBoolean("gestures", true)) {
            return; 
        } 
        ArrayList<Prediction> predictions = gestureLibrary.recognize(gesture);
 
        // We want at least one prediction 
        if (predictions.size() > 0) {
            Prediction prediction = predictions.get(0);
            // We want at least some confidence in the result 
            if (prediction.score > 1.0) {
                int base = tabHost.getCurrentTab();
 
                // Show the spell 
                if (prediction.name.equals("right")) {
                    if (base <= 0) {
                        return; 
                    } 
                    tabHost.setCurrentTab(base - 1);
                }