use of com.yydcdut.note.model.camera.ICameraSettingModel in project PhotoNoter by yydcdut.
the class CameraPresenterImpl method attachView.
@Override
public void attachView(@NonNull IView iView) {
mICameraView = (ICameraView) iView;
mCurrentCameraId = mLocalStorageUtils.getCameraSaveCameraId();
mPictureSize = getPictureSize();
mCameraModel.openCamera(mCurrentCameraId, new ICameraModel.OnCameraOpenedCallback() {
@Override
public void onOpen(IPreviewModel previewModel, ICameraSettingModel cameraSettingModel) {
mPreviewModel = previewModel;
mCameraSettingModel = cameraSettingModel;
if (mPictureSize == null) {
mPictureSize = savePictureSizes(mCurrentCameraId);
}
initUIState();
initLogicState();
mPreviewSize = getSuitablePreviewSize(mCameraSettingModel.getSupportPreviewSizes());
if (mRatioState == Const.LAYOUT_PERSONAL_RATIO_FULL) {
mICameraView.doFullRatioAnimation();
} else if (mRatioState == Const.LAYOUT_PERSONAL_RATIO_4_3) {
mICameraView.do43RatioAnimation();
} else {
mICameraView.do11RatioAnimation();
}
mICameraView.setSize(mPreviewSize.getHeight(), mPreviewSize.getWidth());
onGridClick(-1);
}
@Override
public void onError() {
}
}, getCameraRotation(), mPictureSize);
initLocation();
mHandler = new Handler(this);
}
use of com.yydcdut.note.model.camera.ICameraSettingModel 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);
}
}
Aggregations