Java 类android.hardware.Camera.ShutterCallback 实例源码

项目:nexus-camera    文件:AndroidCameraManagerImpl.java   
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;
            }
        }
    });
}
项目:Camdroid    文件:AutoFocusManager.java   
@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);
            }
        };
    }

}
项目:dmhelper    文件:MyCameraFragment.java   
@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);
}
项目:PaoMovie    文件:MagicCameraDisplay.java   
public void onTakePicture(File file, onPictureSaveListener listener,ShutterCallback shutterCallback){
    CameraEngine.setRotation(90);
    mSaveTask = new SaveTask(mContext, file, listener);
    CameraEngine.takePicture(shutterCallback, null, mPictureCallback);
}
项目:dmhelper    文件:MyCameraHost.java   
@Override
public ShutterCallback getShutterCallback() {
    return null;
}
项目:dmhelper    文件:MyCameraHost.java   
public void setShutterCallback(ShutterCallback callback){
    mCallback = callback;
}