Пример #1
0
  @Override
  public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
    // Log.d(TAG, "Strokes size: " + gesture.getStrokesCount());

    InputConnection ic = getCurrentInputConnection();

    for (GestureStroke stroke : gesture.getStrokes()) {
      GesturePoint[] points = ShorthandUtils.extractGesturePointsFromStroke(stroke);
      String result = mRecognizer.recognize(points);
      if (mParameters.isDebugEnabled()) {
        StenoCanvas canvas = (StenoCanvas) overlay;
        canvas.setDebugPaths(mRecognizer.getDebugPaths());
        canvas.setDebugPoints(points);
      }
      if (result != null && result.length() > 0) {
        ic.commitText(result, 1);
      } else if (mParameters.isPopupsEnabled()) {
        Toast.makeText(mContext, R.string.not_found, Toast.LENGTH_SHORT).show();
      }
    }
  }