public void requestTakePicture( final ShutterCallback shutter, final PictureCallback raw, final PictureCallback postView, final PictureCallback jpeg) { post(new Runnable() { @Override public void run() { try { mCamera.takePicture(shutter, raw, postView, jpeg); } catch (RuntimeException e) { // TODO: output camera state and focus state for debugging. Log.e(TAG, "take picture failed."); throw e; } } }); }
@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); } }; } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int type = getArguments().getInt(CameraActivity.ARGS_TYPE); String creatureName = getArguments().getString(CameraActivity.ARGS_NAME, null); final String filePath; MyCameraHost host; switch(type){ case 1: host = new CreatureCameraHost(getActivity(), creatureName); filePath = CreatureCameraHost.getFilePath(creatureName).getPath(); break; default: throw new IllegalArgumentException("No camera host type declared. Use CameraActivity.ARGS_TYPE_... as argument"); } ShutterCallback callback = new ShutterCallback() { @Override public void onShutter() { Intent i = new Intent(); i.putExtra(CameraActivity.DATA_PATH, filePath); mActivity.setResult(Activity.RESULT_OK, i); mActivity.finish(); } }; host.setShutterCallback(callback); setHost(host); setHasOptionsMenu(true); }
public void onTakePicture(File file, onPictureSaveListener listener,ShutterCallback shutterCallback){ CameraEngine.setRotation(90); mSaveTask = new SaveTask(mContext, file, listener); CameraEngine.takePicture(shutterCallback, null, mPictureCallback); }
@Override public ShutterCallback getShutterCallback() { return null; }
public void setShutterCallback(ShutterCallback callback){ mCallback = callback; }