Java Code Examples for android.hardware.Camera#ShutterCallback

The following examples show how to use android.hardware.Camera#ShutterCallback . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CameraEngine.java    From Fatigue-Detection with MIT License 7 votes vote down vote up
public void takePhoto(){
    Camera.ShutterCallback shutterCallback = new Camera.ShutterCallback() {
        public void onShutter() {
            Log.d(TAG, "onShutter: ");
        }
    };

    Camera.PictureCallback jpegCallback = new Camera.PictureCallback() {
        public void onPictureTaken(final byte[] data, final Camera camera) {
            camera.startPreview();
            Log.d(TAG, "onPictureTaken: ");
            pictureTakenCallBack.saveAsBitmap(data);
        }
    };

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        camera.enableShutterSound(false);
    }

    camera.takePicture(shutterCallback, null, jpegCallback);
}
 
Example 2
Source File: CameraFragment.java    From SquareCamera with MIT License 6 votes vote down vote up
/**
 * Take a picture
 */
private void takePicture() {

    if (mIsSafeToTakePhoto) {
        setSafeToTakePhoto(false);

        mOrientationListener.rememberOrientation();

        // Shutter callback occurs after the image is captured. This can
        // be used to trigger a sound to let the user know that image is taken
        Camera.ShutterCallback shutterCallback = null;

        // Raw callback occurs when the raw image data is available
        Camera.PictureCallback raw = null;

        // postView callback occurs when a scaled, fully processed
        // postView image is available.
        Camera.PictureCallback postView = null;

        // jpeg callback occurs when the compressed image is available
        mCamera.takePicture(shutterCallback, raw, postView, this);
    }
}
 
Example 3
Source File: DefaultCameraActions.java    From Expert-Android-Programming with MIT License 5 votes vote down vote up
private Camera.ShutterCallback rawCallbackOrNull(final EasyCamera.ShutterCallback callback) {
    if (callback != null) {
        return new Camera.ShutterCallback() {
            @Override
            public void onShutter() {
                callback.onShutter();
            }
        };
    }
    return null;
}
 
Example 4
Source File: DefaultCameraActions.java    From EasyCamera with Apache License 2.0 5 votes vote down vote up
private Camera.ShutterCallback rawCallbackOrNull(final EasyCamera.ShutterCallback callback) {
    if (callback != null) {
        return new Camera.ShutterCallback() {
            @Override
            public void onShutter() {
                callback.onShutter();
            }
        };
    }
    return null;
}
 
Example 5
Source File: CameraEngine.java    From TikTok with Apache License 2.0 4 votes vote down vote up
public static void takePicture(Camera.ShutterCallback shutterCallback, Camera.PictureCallback rawCallback,
                               Camera.PictureCallback jpegCallback){
    camera.takePicture(shutterCallback, rawCallback, jpegCallback);
}
 
Example 6
Source File: CameraClass.java    From GoFIT_SDK_Android with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
public static void cameraTakePicture(Camera.ShutterCallback shutterCallback, Camera.PictureCallback pictureCallback) {
    AppContract.mCamera.takePicture(shutterCallback, null, pictureCallback);
}
 
Example 7
Source File: CameraManager.java    From Tesseract-OCR-Scanner with Apache License 2.0 4 votes vote down vote up
public void takeShot(Camera.ShutterCallback shutterCallback,
                     Camera.PictureCallback rawPictureCallback,
                     Camera.PictureCallback jpegPictureCallback ){

    mCamera.takePicture(shutterCallback, rawPictureCallback, jpegPictureCallback);
}
 
Example 8
Source File: Camera1View.java    From oneHookLibraryAndroid with Apache License 2.0 4 votes vote down vote up
public void takePicture(Camera.ShutterCallback callback, Camera.PictureCallback rawPictureCallback, Camera.PictureCallback jpgPictureCallback) {
    mCamera.takePicture(callback, rawPictureCallback, jpgPictureCallback);
    mIsSafeToTakePicture = false;
}