/**
  * Convenience method for {@link com.google.zxing.client.android.CaptureActivity}
  *
  * @param newSetting if {@code true}, light should be turned on if currently off. And vice versa.
  */
 public synchronized void setTorch(boolean newSetting) {
   if (newSetting != configManager.getTorchState(camera)) {
     if (camera != null) {
       if (autoFocusManager != null) {
         autoFocusManager.stop();
       }
       configManager.setTorch(camera, newSetting);
       if (autoFocusManager != null) {
         autoFocusManager.start();
       }
     }
   }
 }
예제 #2
0
 /** Tells the camera to stop drawing preview frames. */
 public synchronized void stopPreview() {
   if (autoFocusManager != null) {
     autoFocusManager.stop();
     autoFocusManager = null;
   }
   if (camera != null && previewing) {
     camera.stopPreview();
     previewCallback.setHandler(null, 0);
     previewing = false;
   }
 }
예제 #3
0
 /**
  * Asks the camera hardware to perform an autofocus.
  *
  * @param delay Time delay to send with the request
  */
 public synchronized void requestAutoFocus(long delay) {
   autoFocusManager.start(delay);
 }