/** Send a decode request for realtime OCR mode */
  private void restartOcrPreviewAndDecode() {
    // Continue capturing camera frames
    cameraManager.startPreview();

    // Continue requesting decode of images
    cameraManager.requestOcrDecode(decodeThread.getHandler(), R.id.ocr_continuous_decode);
    activity.drawViewfinder();
  }
  CaptureActivityHandler(
      CaptureActivity activity,
      CameraManager cameraManager,
      TessBaseAPI baseApi,
      boolean isContinuousModeActive) {
    this.activity = activity;
    v = (Vibrator) activity.getSystemService(Context.VIBRATOR_SERVICE);
    this.cameraManager = cameraManager;
    // Start ourselves capturing previews (and decoding if using continuous recognition mode).

    cameraManager.startPreview();

    decodeThread =
        new DecodeThread(
            activity,
            // new ViewfinderResultPointCallback(activity.getViewfinderView()),
            baseApi);
    decodeThread.start();

    /*if (isContinuousModeActive) {
      state = State.CONTINUOUS;

      // Show the shutter and torch buttons
      activity.setButtonVisibility(true);

      // Display a "be patient" message while first recognition request is running
      activity.setStatusViewForContinuous();

      cameraManager.requestAutoFocus(this, R.id.auto_focus);
      restartOcrPreviewAndDecode();
    } else {*/
    setState(State.SUCCESS);

    // Show the shutter and torch buttons
    activity.setButtonVisibility(true);

    restartOcrPreview();
    //  }
  }