/** * Closes the camera driver if still in use. */ public synchronized void closeDriver() { if (camera != null) { camera.getCamera().release(); camera = null; // Make sure to clear these each time we close the camera, so that any scanning rect // requested by intent is forgotten. framingRect = null; framingRectInPreview = null; } }
/** * Closes the camera driver if still in use. */ public synchronized void closeDriver() { if (camera != null) { camera.getCamera().release(); camera = null; // Make sure to clear these each time we close the camera, so that any scanning rect // requested by intent is forgotten. framingRect = null; framingRectInPreview = null; } }
/** * Asks the camera hardware to begin drawing preview frames to the screen. */ public synchronized void startPreview() { OpenCamera theCamera = camera; if (theCamera != null && !previewing) { theCamera.getCamera().startPreview(); previewing = true; autoFocusManager = new AutoFocusManager(context, theCamera.getCamera()); } }
/** * Asks the camera hardware to begin drawing preview frames to the screen. */ public synchronized void startPreview() { OpenCamera theCamera = camera; if (theCamera != null && !previewing) { theCamera.getCamera().startPreview(); previewing = true; autoFocusManager = new AutoFocusManager(context, theCamera.getCamera()); } }
/** * Tells the camera to stop drawing preview frames. */ public synchronized void stopPreview() { if (autoFocusManager != null) { autoFocusManager.stop(); autoFocusManager = null; } if (camera != null && previewing) { camera.getCamera().stopPreview(); previewCallback.setHandler(null, 0); previewing = false; } }
/** * Tells the camera to stop drawing preview frames. */ public synchronized void stopPreview() { if (autoFocusManager != null) { autoFocusManager.stop(); autoFocusManager = null; } if (camera != null && previewing) { camera.getCamera().stopPreview(); previewCallback.setHandler(null, 0); previewing = false; } }
/** * A single preview frame will be returned to the handler supplied. The data will arrive as byte[] * in the message.obj field, with width and height encoded as message.arg1 and message.arg2, * respectively. * * @param handler The handler to send the message to. * @param message The what field of the message to be sent. */ public synchronized void requestPreviewFrame(Handler handler, int message) { OpenCamera theCamera = camera; if (theCamera != null && previewing) { previewCallback.setHandler(handler, message); theCamera.getCamera().setOneShotPreviewCallback(previewCallback); } }
/** * A single preview frame will be returned to the handler supplied. The data will arrive as byte[] * in the message.obj field, with width and height encoded as message.arg1 and message.arg2, * respectively. * * @param handler The handler to send the message to. * @param message The what field of the message to be sent. */ public synchronized void requestPreviewFrame(Handler handler, int message) { OpenCamera theCamera = camera; if (theCamera != null && previewing) { previewCallback.setHandler(handler, message); theCamera.getCamera().setOneShotPreviewCallback(previewCallback); } }
/** * Convenience method * * @param newSetting if {@code true}, light should be turned on if currently off. And vice versa. */ public synchronized void setTorch(boolean newSetting) { OpenCamera theCamera = camera; if (theCamera != null) { if (newSetting != configManager.getTorchState(theCamera.getCamera())) { boolean wasAutoFocusManager = autoFocusManager != null; if (wasAutoFocusManager) { autoFocusManager.stop(); autoFocusManager = null; } configManager.setTorch(theCamera.getCamera(), newSetting); if (wasAutoFocusManager) { autoFocusManager = new AutoFocusManager(context, theCamera.getCamera()); autoFocusManager.start(); } } } }
/** * Convenience method * * @param newSetting if {@code true}, light should be turned on if currently off. And vice versa. */ public synchronized void setTorch(boolean newSetting) { OpenCamera theCamera = camera; if (theCamera != null) { if (newSetting != configManager.getTorchState(theCamera.getCamera())) { boolean wasAutoFocusManager = autoFocusManager != null; if (wasAutoFocusManager) { autoFocusManager.stop(); autoFocusManager = null; } configManager.setTorch(theCamera.getCamera(), newSetting); if (wasAutoFocusManager) { autoFocusManager = new AutoFocusManager(context, theCamera.getCamera()); autoFocusManager.start(); } } } }
Camera.Parameters parameters = camera.getCamera().getParameters(); WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = manager.getDefaultDisplay();
Camera.Parameters parameters = camera.getCamera().getParameters(); WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = manager.getDefaultDisplay();
void setDesiredCameraParameters(OpenCamera camera, boolean safeMode) { Camera theCamera = camera.getCamera(); Camera.Parameters parameters = theCamera.getParameters();
void setDesiredCameraParameters(OpenCamera camera, boolean safeMode) { Camera theCamera = camera.getCamera(); Camera.Parameters parameters = theCamera.getParameters();
Camera cameraObject = theCamera.getCamera(); Camera.Parameters parameters = cameraObject.getParameters();
Camera cameraObject = theCamera.getCamera(); Camera.Parameters parameters = cameraObject.getParameters();