Rename methods

v2
Mattia Iavarone 6 years ago
parent 9cf23c854e
commit 28ff1ee56b
  1. 30
      cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java

@ -215,11 +215,11 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera
Camera.Parameters params = mCamera.getParameters(); Camera.Parameters params = mCamera.getParameters();
mCameraOptions = new CameraOptions(params, flip(REF_SENSOR, REF_VIEW)); mCameraOptions = new CameraOptions(params, flip(REF_SENSOR, REF_VIEW));
applyDefaultFocus(params); applyDefaultFocus(params);
mergeFlash(params, Flash.DEFAULT); applyFlash(params, Flash.DEFAULT);
mergeLocation(params, null); applyLocation(params, null);
mergeWhiteBalance(params, WhiteBalance.DEFAULT); applyWhiteBalance(params, WhiteBalance.DEFAULT);
mergeHdr(params, Hdr.DEFAULT); applyHdr(params, Hdr.DEFAULT);
mergePlaySound(mPlaySounds); applyPlaySounds(mPlaySounds);
params.setRecordingHint(mMode == Mode.VIDEO); params.setRecordingHint(mMode == Mode.VIDEO);
mCamera.setParameters(params); mCamera.setParameters(params);
mCamera.setDisplayOrientation(offset(REF_SENSOR, REF_VIEW)); // <- not allowed during preview mCamera.setDisplayOrientation(offset(REF_SENSOR, REF_VIEW)); // <- not allowed during preview
@ -347,12 +347,12 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera
@Override @Override
public void run() { public void run() {
Camera.Parameters params = mCamera.getParameters(); Camera.Parameters params = mCamera.getParameters();
if (mergeLocation(params, oldLocation)) mCamera.setParameters(params); if (applyLocation(params, oldLocation)) mCamera.setParameters(params);
} }
}); });
} }
private boolean mergeLocation(Camera.Parameters params, Location oldLocation) { private boolean applyLocation(Camera.Parameters params, Location oldLocation) {
if (mLocation != null) { if (mLocation != null) {
params.setGpsLatitude(mLocation.getLatitude()); params.setGpsLatitude(mLocation.getLatitude());
params.setGpsLongitude(mLocation.getLongitude()); params.setGpsLongitude(mLocation.getLongitude());
@ -389,12 +389,12 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera
@Override @Override
public void run() { public void run() {
Camera.Parameters params = mCamera.getParameters(); Camera.Parameters params = mCamera.getParameters();
if (mergeWhiteBalance(params, old)) mCamera.setParameters(params); if (applyWhiteBalance(params, old)) mCamera.setParameters(params);
} }
}); });
} }
private boolean mergeWhiteBalance(Camera.Parameters params, WhiteBalance oldWhiteBalance) { private boolean applyWhiteBalance(Camera.Parameters params, WhiteBalance oldWhiteBalance) {
if (mCameraOptions.supports(mWhiteBalance)) { if (mCameraOptions.supports(mWhiteBalance)) {
params.setWhiteBalance((String) mMapper.map(mWhiteBalance)); params.setWhiteBalance((String) mMapper.map(mWhiteBalance));
return true; return true;
@ -411,12 +411,12 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera
@Override @Override
public void run() { public void run() {
Camera.Parameters params = mCamera.getParameters(); Camera.Parameters params = mCamera.getParameters();
if (mergeHdr(params, old)) mCamera.setParameters(params); if (applyHdr(params, old)) mCamera.setParameters(params);
} }
}); });
} }
private boolean mergeHdr(Camera.Parameters params, Hdr oldHdr) { private boolean applyHdr(Camera.Parameters params, Hdr oldHdr) {
if (mCameraOptions.supports(mHdr)) { if (mCameraOptions.supports(mHdr)) {
params.setSceneMode((String) mMapper.map(mHdr)); params.setSceneMode((String) mMapper.map(mHdr));
return true; return true;
@ -426,7 +426,7 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera
} }
@TargetApi(17) @TargetApi(17)
private boolean mergePlaySound(boolean oldPlaySound) { private boolean applyPlaySounds(boolean oldPlaySound) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
Camera.CameraInfo info = new Camera.CameraInfo(); Camera.CameraInfo info = new Camera.CameraInfo();
Camera.getCameraInfo(mCameraId, info); Camera.getCameraInfo(mCameraId, info);
@ -462,13 +462,13 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera
@Override @Override
public void run() { public void run() {
Camera.Parameters params = mCamera.getParameters(); Camera.Parameters params = mCamera.getParameters();
if (mergeFlash(params, old)) mCamera.setParameters(params); if (applyFlash(params, old)) mCamera.setParameters(params);
} }
}); });
} }
private boolean mergeFlash(Camera.Parameters params, Flash oldFlash) { private boolean applyFlash(Camera.Parameters params, Flash oldFlash) {
if (mCameraOptions.supports(mFlash)) { if (mCameraOptions.supports(mFlash)) {
params.setFlashMode((String) mMapper.map(mFlash)); params.setFlashMode((String) mMapper.map(mFlash));
return true; return true;
@ -946,7 +946,7 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera
schedule(mPlaySoundsTask, true, new Runnable() { schedule(mPlaySoundsTask, true, new Runnable() {
@Override @Override
public void run() { public void run() {
mergePlaySound(old); applyPlaySounds(old);
} }
}); });
} }

Loading…
Cancel
Save