android.hardware.Camera.ShutterCallback Java Examples

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: AndroidCameraAgentImpl.java    From Camera2 with Apache License 2.0 5 votes vote down vote up
CaptureCallbacks(ShutterCallback shutter, PictureCallback raw, PictureCallback postView,
        PictureCallback jpeg) {
    mShutter = shutter;
    mRaw = raw;
    mPostView = postView;
    mJpeg = jpeg;
}
 
Example #2
Source File: AndroidCameraAgentImpl.java    From Camera2 with Apache License 2.0 5 votes vote down vote up
public void requestTakePicture(
        final ShutterCallback shutter,
        final PictureCallback raw,
        final PictureCallback postView,
        final PictureCallback jpeg) {
    final CaptureCallbacks callbacks = new CaptureCallbacks(shutter, raw, postView, jpeg);
    obtainMessage(CameraActions.CAPTURE_PHOTO, callbacks).sendToTarget();
}
 
Example #3
Source File: AutoFocusManager.java    From Camdroid with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public AutoFocusManager(final Context context, Camera camera,
                        final boolean canDisableSystemShutterSound) {
    this.camera = camera;
    this.executor = Executors.newSingleThreadScheduledExecutor();

    this.focusAccelerationEventListener = new FocusAccelerationEventListener(
            context, SensorManager.SENSOR_DELAY_GAME);
    this.focusAmbientLightEventListener = new FocusAmbientLightEventListener(
            context, SensorManager.SENSOR_DELAY_GAME);

    String focusMode = this.camera.getParameters().getFocusMode();
    this.must_call_auto_focus = Camera.Parameters.FOCUS_MODE_AUTO
            .equals(focusMode)
            || Camera.Parameters.FOCUS_MODE_MACRO.equals(focusMode);

    int[] soundRes = new int[0];
    if (this.must_call_auto_focus) {
        soundRes = Arrays.copyOf(soundRes, soundRes.length + 1);
        soundRes[soundRes.length - 1] = R.raw.beep;
    }
    if (canDisableSystemShutterSound) {
        soundRes = Arrays.copyOf(soundRes, soundRes.length + 1);
        soundRes[soundRes.length - 1] = R.raw.shutter;
    }

    this.soundManager = new SoundManager(context, soundRes);

    if (canDisableSystemShutterSound) {
        this.shutterCallback = new ShutterCallback() {
            @Override
            public void onShutter() {
                AutoFocusManager.this.soundManager.play(R.raw.shutter);
            }
        };
    }

}