/** Start the preview, but don't try to OCR anything until the user presses the shutter button. */ private void restartOcrPreview() { // Display the shutter and torch buttons activity.setButtonVisibility(true); if (getState() == State.SUCCESS) { setState(State.PREVIEW); // Draw the viewfinder. activity.drawViewfinder(); // Start cycling the autofocus if (!isAutofocusLoopStarted) { // isAutofocusLoopStarted = true; requestAutofocus(R.id.auto_focus); } } }
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(); // } }