public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
    ArrayList<Prediction> predictions = mLibrary.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) {
        // Show the spell
        Toast.makeText(this, prediction.name, Toast.LENGTH_SHORT).show();
      }
    }
  }
Beispiel #2
0
        public void onGesturePerformed(GestureOverlayView gestureView, Gesture gesture) {

          String gesturesPrefs = getString(R.string.prefs_gestures);
          Boolean gesturesPrefsVal =
              NotePrefsDb.getBooleanValue(NoteEdit.this, gesturesPrefs, true);

          if (gesturesPrefsVal == false) {
            return;
          }

          ArrayList<Prediction> predictions = gLib.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) {

              // if they aren't in edit mode, and it's prev or next, return, but tell the main
              // activity to do something
              if (isEditable == false) {

                Intent data = new Intent();
                data.putExtra(NoteDb.KEY_ROWID, mRowId + "");

                if (prediction.name.equals("Swipe Left")) {
                  setResult(NotelyMain.ACTIVITY_PREVIOUS_NOTE, data);
                  finish();
                } else if (prediction.name.equals("Swipe Right")) {
                  setResult(NotelyMain.ACTIVITY_NEXT_NOTE, data);
                  finish();
                }
              }
            }
          }
        }
Beispiel #3
0
  @Override
  public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
    ArrayList<Prediction> predictions = gestureLib.recognize(gesture);
    String sTheme;
    // Log.i(TAG, "predictions: "+predictions.toString());
    TextView sliderText = (TextView) findViewById(R.id.verticalSeekbarText);
    for (Prediction prediction : predictions) {
      if (prediction.score > 1.0) {
        //                    Toast.makeText(this, prediction.name, Toast.LENGTH_SHORT)
        //                      .show();
        if (prediction.name.contains("right")) {
          sTheme = mView.nextFilterSubset();
          // Process frame to show results
          mView.process(1);

          if (sTheme != null) {
            movementCounter++;
            sliderText.setText("Next Theme: " + sTheme);
            /*Toast.makeText(ICSeeRealtimeActivity.this, "Next Theme: " + sTheme,
            Toast.LENGTH_SHORT).show();*/
            mView.saveCurrentFilterSet(); // Store filter for later reference
            SoundPlayer.playSound(this.getApplicationContext(), SoundPlayer.S2);
            try {
              Thread.sleep(500);
            } catch (InterruptedException e) {
              e.printStackTrace();
            }
            if (!movementTutorial) {
              if (icSeeTutorial.getTutorialState(mContext) == 1) {
                movementTutorial = true;
              }
              // icSeeTutorial.playSound(this.getApplicationContext(), 2);
              ICSeeTutorial.playChangedFilter(mContext);
            } else if (movementCounter == 4) {
              ICSeeTutorial.playAutoFocus(mContext);
              movementCounter = 0;
            }
          } else {
            mView.initFilterSubsets();
            sliderText.setText("No theme applicable");
            /*Toast.makeText(ICSeeRealtimeActivity.this, "No theme applicable",
            Toast.LENGTH_SHORT).show();*/
            SoundPlayer.playSound(this.getApplicationContext(), SoundPlayer.S1);
            // icSeeTutorial.playSound(this.getApplicationContext(), 5);
            ICSeeTutorial.playNoFiltersLeft(mContext);
          }
        } else if (prediction.name.contains("left")) {
          sTheme = mView.previousFilterSubset();
          // Process frame to show results
          mView.process(1);

          if (sTheme != null) {
            movementCounter++;
            sliderText.setText("Previous Theme: " + sTheme);
            /*Toast.makeText(ICSeeRealtimeActivity.this, "Previous Theme: " + sTheme,
            Toast.LENGTH_SHORT).show();*/
            mView.saveCurrentFilterSet(); // Store filter for later reference
            SoundPlayer.playSound(this.getApplicationContext(), SoundPlayer.S3);
            try {
              Thread.sleep(500);
            } catch (InterruptedException e) {
              e.printStackTrace();
            }
            if (!movementTutorial) {
              if (icSeeTutorial.getTutorialState(mContext) == 1) {
                movementTutorial = true;
              }
              // icSeeTutorial.playSound(this.getApplicationContext(), 2);
              ICSeeTutorial.playChangedFilter(mContext);
            } else if (movementCounter == 4) {
              ICSeeTutorial.playAutoFocus(mContext);
              movementCounter = 0;
            }
          } else {
            mView.initFilterSubsets();
            sliderText.setText("No theme applicable");
            /*Toast.makeText(ICSeeRealtimeActivity.this, "No theme applicable",
            Toast.LENGTH_SHORT).show();*/
            SoundPlayer.playSound(this.getApplicationContext(), SoundPlayer.S1);
            // icSeeTutorial.playSound(this.getApplicationContext(), 5);
            ICSeeTutorial.playNoFiltersRight(mContext);
          }
        } else if (prediction.name.contains("omicron")
            || prediction.name.contains("omicron1")
            || prediction.name.contains("omicron2")
            || prediction.name.contains("omicron3")
            || prediction.name.contains("omicron4")) {
          // if tutorial state is off
          if (icSeeTutorial.getTutorialState(mContext) == 0) {
            icSeeTutorial.tutorialOn();
            ICSeeTutorial.playTutorialOn(mContext);
            movementTutorial = false;
            icSeeTutorial.getTutorialState(mContext);
          } else {
            icSeeTutorial.tutorialOff();
            icSeeTutorial.stopSound();
            ICSeeTutorial.playTutorialOff(mContext);
            icSeeTutorial.getTutorialState(mContext);
          }
        }
      }
    }
  }