Search in sources :

Example 1 with ICameraFocus

use of com.yydcdut.note.model.camera.ICameraFocus in project PhotoNoter by yydcdut.

the class CameraPresenterImpl method onCameraIdClick.

@Override
public void onCameraIdClick(int state) {
    if (mCameraSettingModel != null && mCameraSettingModel.getNumberOfCameras() == 2) {
        if (Const.CAMERA_BACK.equals(mCurrentCameraId)) {
            mCurrentCameraId = Const.CAMERA_FRONT;
        } else {
            mCurrentCameraId = Const.CAMERA_BACK;
        }
        closeCamera();
        final Size pictureSize = getPictureSize();
        mCameraModel.openCamera(mCurrentCameraId, new ICameraModel.OnCameraOpenedCallback() {

            @Override
            public void onOpen(IPreviewModel previewModel, ICameraSettingModel cameraSettingModel) {
                mPreviewModel = previewModel;
                mCameraSettingModel = cameraSettingModel;
                if (pictureSize == null) {
                    savePictureSizes(mCurrentCameraId);
                }
                initUIState();
                initLogicState();
                mPreviewSize = getSuitablePreviewSize(mCameraSettingModel.getSupportPreviewSizes());
                mPreviewModel.startPreview(mPreviewSurface, new IPreviewModel.OnCameraPreviewCallback() {

                    @Override
                    public void onPreview(ICaptureModel captureModel, ICameraFocus cameraFocus) {
                        mCaptureModel = captureModel;
                        mCameraFocus = cameraFocus;
                    }

                    @Override
                    public void onPreviewError() {
                    }
                }, mPreviewSize);
            }

            @Override
            public void onError() {
            }
        }, getCameraRotation(), pictureSize);
    }
}
Also used : ICameraFocus(com.yydcdut.note.model.camera.ICameraFocus) ICameraModel(com.yydcdut.note.model.camera.ICameraModel) IPreviewModel(com.yydcdut.note.model.camera.IPreviewModel) Size(com.yydcdut.note.utils.camera.param.Size) ICameraSettingModel(com.yydcdut.note.model.camera.ICameraSettingModel) ICaptureModel(com.yydcdut.note.model.camera.ICaptureModel)

Aggregations

ICameraFocus (com.yydcdut.note.model.camera.ICameraFocus)1 ICameraModel (com.yydcdut.note.model.camera.ICameraModel)1 ICameraSettingModel (com.yydcdut.note.model.camera.ICameraSettingModel)1 ICaptureModel (com.yydcdut.note.model.camera.ICaptureModel)1 IPreviewModel (com.yydcdut.note.model.camera.IPreviewModel)1 Size (com.yydcdut.note.utils.camera.param.Size)1