Reorder CameraEngine members

pull/494/head
Mattia Iavarone 6 years ago
parent c617a7da2a
commit 62cfb5d7f0
  1. 14
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/CameraViewTest.java
  2. 26
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/engine/MockCameraEngine.java
  3. 11
      cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera1Engine.java
  4. 16
      cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera2Engine.java
  5. 355
      cameraview/src/main/java/com/otaliastudios/cameraview/engine/CameraEngine.java
  6. 10
      cameraview/src/main/java/com/otaliastudios/cameraview/gesture/GestureFinder.java

@ -231,7 +231,7 @@ public class CameraViewTest extends BaseTest {
ui(new Runnable() {
@Override
public void run() {
cameraView.mTapGestureFinder = new TapGestureFinder(cameraView.getContext()) {
cameraView.mTapGestureFinder = new TapGestureFinder(cameraView.mCameraCallbacks) {
protected boolean handleTouchEvent(@NonNull MotionEvent event) {
setGesture(Gesture.TAP);
return true;
@ -253,7 +253,7 @@ public class CameraViewTest extends BaseTest {
ui(new Runnable() {
@Override
public void run() {
cameraView.mTapGestureFinder = new TapGestureFinder(cameraView.getContext()) {
cameraView.mTapGestureFinder = new TapGestureFinder(cameraView.mCameraCallbacks) {
protected boolean handleTouchEvent(@NonNull MotionEvent event) {
setGesture(Gesture.TAP);
return true;
@ -280,7 +280,7 @@ public class CameraViewTest extends BaseTest {
ui(new Runnable() {
@Override
public void run() {
cameraView.mPinchGestureFinder = new PinchGestureFinder(cameraView.getContext()) {
cameraView.mPinchGestureFinder = new PinchGestureFinder(cameraView.mCameraCallbacks) {
@Override
protected boolean handleTouchEvent(@NonNull MotionEvent event) {
setGesture(Gesture.PINCH);
@ -321,7 +321,7 @@ public class CameraViewTest extends BaseTest {
ui(new Runnable() {
@Override
public void run() {
cameraView.mScrollGestureFinder = new ScrollGestureFinder(cameraView.getContext()) {
cameraView.mScrollGestureFinder = new ScrollGestureFinder(cameraView.mCameraCallbacks) {
@Override
protected boolean handleTouchEvent(@NonNull MotionEvent event) {
setGesture(Gesture.SCROLL_HORIZONTAL);
@ -626,7 +626,7 @@ public class CameraViewTest extends BaseTest {
public void testPreviewStreamSizeSelector() {
SizeSelector source = SizeSelectors.minHeight(50);
cameraView.setPreviewStreamSize(source);
SizeSelector result = mockController.getInternalPreviewStreamSizeSelector();
SizeSelector result = mockController.getPreviewStreamSizeSelector();
assertNotNull(result);
assertEquals(result, source);
}
@ -635,7 +635,7 @@ public class CameraViewTest extends BaseTest {
public void testPictureSizeSelector() {
SizeSelector source = SizeSelectors.minHeight(50);
cameraView.setPictureSize(source);
SizeSelector result = mockController.getInternalPictureSizeSelector();
SizeSelector result = mockController.getPictureSizeSelector();
assertNotNull(result);
assertEquals(result, source);
}
@ -644,7 +644,7 @@ public class CameraViewTest extends BaseTest {
public void testVideoSizeSelector() {
SizeSelector source = SizeSelectors.minHeight(50);
cameraView.setVideoSize(source);
SizeSelector result = mockController.getInternalVideoSizeSelector();
SizeSelector result = mockController.getVideoSizeSelector();
assertNotNull(result);
assertEquals(result, source);
}

@ -87,27 +87,6 @@ public class MockCameraEngine extends CameraEngine {
mEngineStep.setState(started ? STATE_STARTED : STATE_STOPPED);
}
public int getSnapshotMaxWidth() {
return mSnapshotMaxWidth;
}
public int getSnapshotMaxHeight() {
return mSnapshotMaxHeight;
}
public SizeSelector getInternalPreviewStreamSizeSelector() {
return super.getPreviewStreamSizeSelector();
}
public SizeSelector getInternalPictureSizeSelector() {
return super.getPictureSizeSelector();
}
public SizeSelector getInternalVideoSizeSelector() {
return super.getVideoSizeSelector();
}
@Override
public void setZoom(float zoom, @Nullable PointF[] points, boolean notify) {
mZoomValue = zoom;
@ -194,11 +173,6 @@ public class MockCameraEngine extends CameraEngine {
}
@Override
public void setHasFrameProcessors(boolean hasFrameProcessors) {
}
@Override
protected boolean collectCameraInfo(@NonNull Facing facing) {
return true;

@ -125,7 +125,7 @@ public class Camera1Engine extends CameraEngine implements
applyWhiteBalance(params, WhiteBalance.AUTO);
applyHdr(params, Hdr.OFF);
applyPlaySounds(mPlaySounds);
params.setRecordingHint(mMode == Mode.VIDEO);
params.setRecordingHint(getMode() == Mode.VIDEO);
mCamera.setParameters(params);
mCamera.setDisplayOrientation(offset(REF_SENSOR, REF_VIEW)); // <- not allowed during preview
LOG.i("onStartEngine:", "Ended");
@ -170,7 +170,7 @@ public class Camera1Engine extends CameraEngine implements
Camera.Parameters params = mCamera.getParameters();
mPreviewStreamFormat = params.getPreviewFormat();
params.setPreviewSize(mPreviewStreamSize.getWidth(), mPreviewStreamSize.getHeight()); // <- not allowed during preview
if (mMode == Mode.PICTURE) {
if (getMode() == Mode.PICTURE) {
params.setPictureSize(mCaptureSize.getWidth(), mCaptureSize.getHeight()); // <- allowed
} else {
// mCaptureSize in this case is a video size. The available video sizes are not necessarily
@ -285,11 +285,6 @@ public class Camera1Engine extends CameraEngine implements
return false;
}
@Override
public void setHasFrameProcessors(boolean hasFrameProcessors) {
mHasFrameProcessors = hasFrameProcessors;
}
@NonNull
@Override
protected FrameManager instantiateFrameManager() {
@ -443,7 +438,7 @@ public class Camera1Engine extends CameraEngine implements
private void applyDefaultFocus(@NonNull Camera.Parameters params) {
List<String> modes = params.getSupportedFocusModes();
if (mMode == Mode.VIDEO &&
if (getMode() == Mode.VIDEO &&
modes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) {
params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
return;

@ -406,7 +406,7 @@ public class Camera2Engine extends CameraEngine implements ImageReader.OnImageAv
outputSurfaces.add(mPreviewStreamSurface);
// 2. VIDEO RECORDING
if (mMode == Mode.VIDEO) {
if (getMode() == Mode.VIDEO) {
if (Full2VideoRecorder.SUPPORTS_PERSISTENT_SURFACE) {
mFullVideoPersistentSurface = MediaCodec.createPersistentInputSurface();
outputSurfaces.add(mFullVideoPersistentSurface);
@ -422,7 +422,7 @@ public class Camera2Engine extends CameraEngine implements ImageReader.OnImageAv
}
// 3. PICTURE RECORDING
if (mMode == Mode.PICTURE) {
if (getMode() == Mode.PICTURE) {
mPictureReader = ImageReader.newInstance(
mCaptureSize.getWidth(),
mCaptureSize.getHeight(),
@ -433,7 +433,7 @@ public class Camera2Engine extends CameraEngine implements ImageReader.OnImageAv
}
// 4. FRAME PROCESSING
if (mHasFrameProcessors) {
if (hasFrameProcessors()) {
// Choose the size.
StreamConfigurationMap streamMap = mCameraCharacteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
if (streamMap == null) throw new RuntimeException("StreamConfigurationMap is null. Should not happen.");
@ -494,8 +494,8 @@ public class Camera2Engine extends CameraEngine implements ImageReader.OnImageAv
throw new IllegalStateException("previewStreamSize should not be null at this point.");
}
mPreview.setStreamSize(previewSizeForView.getWidth(), previewSizeForView.getHeight());
mPreview.setDrawRotation(mDisplayOffset);
if (mHasFrameProcessors) {
mPreview.setDrawRotation(getDisplayOffset());
if (hasFrameProcessors()) {
getFrameManager().setUp(ImageFormat.getBitsPerPixel(FRAME_PROCESSING_FORMAT), mFrameProcessingSize);
}
@ -537,7 +537,7 @@ public class Camera2Engine extends CameraEngine implements ImageReader.OnImageAv
mVideoRecorder = null;
}
mPictureRecorder = null;
if (mHasFrameProcessors) {
if (hasFrameProcessors()) {
getFrameManager().release();
}
try {
@ -764,7 +764,7 @@ public class Camera2Engine extends CameraEngine implements ImageReader.OnImageAv
int[] modesArray = readCharacteristic(CameraCharacteristics.CONTROL_AF_AVAILABLE_MODES, new int[]{});
List<Integer> modes = new ArrayList<>();
for (int mode : modesArray) { modes.add(mode); }
if (mMode == Mode.VIDEO &&
if (getMode() == Mode.VIDEO &&
modes.contains(CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_VIDEO)) {
builder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_VIDEO);
return;
@ -1064,8 +1064,8 @@ public class Camera2Engine extends CameraEngine implements ImageReader.OnImageAv
@Override
public void setHasFrameProcessors(final boolean hasFrameProcessors) {
super.setHasFrameProcessors(hasFrameProcessors);
LOG.i("setHasFrameProcessors", "changed to", hasFrameProcessors, "posting.");
mHasFrameProcessors = hasFrameProcessors;
mHandler.run(new Runnable() {
@Override
public void run() {

@ -139,10 +139,10 @@ public abstract class CameraEngine implements
private static final String TAG = CameraEngine.class.getSimpleName();
private static final CameraLogger LOG = CameraLogger.create(TAG);
@SuppressWarnings("WeakerAccess")
@SuppressWarnings({"WeakerAccess", "unused"})
public static final int STATE_STOPPING = CameraEngineStep.STATE_STOPPING;
public static final int STATE_STOPPED = CameraEngineStep.STATE_STOPPED;
@SuppressWarnings("WeakerAccess")
@SuppressWarnings({"WeakerAccess", "unused"})
public static final int STATE_STARTING = CameraEngineStep.STATE_STARTING;
public static final int STATE_STARTED = CameraEngineStep.STATE_STARTED;
@ -150,48 +150,47 @@ public abstract class CameraEngine implements
public static final int REF_VIEW = 1;
public static final int REF_OUTPUT = 2;
protected final Callback mCallback;
private final FrameManager mFrameManager;
protected CameraPreview mPreview;
protected WorkerHandler mHandler;
// Need to be protected
@SuppressWarnings("WeakerAccess") protected WorkerHandler mHandler;
@SuppressWarnings("WeakerAccess") protected final Callback mCallback;
@SuppressWarnings("WeakerAccess") protected CameraPreview mPreview;
@SuppressWarnings("WeakerAccess") protected CameraOptions mCameraOptions;
@SuppressWarnings("WeakerAccess") protected Mapper mMapper;
@SuppressWarnings("WeakerAccess") protected PictureRecorder mPictureRecorder;
@SuppressWarnings("WeakerAccess") protected VideoRecorder mVideoRecorder;
@SuppressWarnings("WeakerAccess") protected Size mCaptureSize;
@SuppressWarnings("WeakerAccess") protected Size mPreviewStreamSize;
@SuppressWarnings("WeakerAccess") protected Facing mFacing;
@SuppressWarnings("WeakerAccess") protected Flash mFlash;
@SuppressWarnings("WeakerAccess") protected WhiteBalance mWhiteBalance;
@SuppressWarnings("WeakerAccess") protected VideoCodec mVideoCodec;
@SuppressWarnings("WeakerAccess") protected Hdr mHdr;
@SuppressWarnings("WeakerAccess") protected Location mLocation;
@SuppressWarnings("WeakerAccess") protected float mZoomValue;
@SuppressWarnings("WeakerAccess") protected float mExposureCorrectionValue;
@SuppressWarnings("WeakerAccess") protected boolean mPlaySounds;
@SuppressWarnings("WeakerAccess") protected int mSensorOffset;
// Can be private
@VisibleForTesting Handler mCrashHandler;
protected Facing mFacing;
protected Flash mFlash;
protected WhiteBalance mWhiteBalance;
protected VideoCodec mVideoCodec;
protected Mode mMode;
protected Hdr mHdr;
protected Location mLocation;
protected Audio mAudio;
protected float mZoomValue;
protected float mExposureCorrectionValue;
protected boolean mPlaySounds;
protected boolean mHasFrameProcessors;
private final FrameManager mFrameManager;
@Nullable private SizeSelector mPreviewStreamSizeSelector;
private SizeSelector mPictureSizeSelector;
private SizeSelector mVideoSizeSelector;
@VisibleForTesting int mSnapshotMaxWidth = Integer.MAX_VALUE; // in REF_VIEW for consistency with SizeSelectors
@VisibleForTesting int mSnapshotMaxHeight = Integer.MAX_VALUE; // in REF_VIEW for consistency with SizeSelectors
protected CameraOptions mCameraOptions;
protected Mapper mMapper;
protected PictureRecorder mPictureRecorder;
protected VideoRecorder mVideoRecorder;
protected long mVideoMaxSize;
protected int mVideoMaxDuration;
protected int mVideoBitRate;
protected int mAudioBitRate;
protected Size mCaptureSize;
protected Size mPreviewStreamSize;
protected long mAutoFocusResetDelayMillis;
protected int mSensorOffset;
protected int mDisplayOffset;
protected int mDeviceOrientation;
private Mode mMode;
private Audio mAudio;
private long mVideoMaxSize;
private int mVideoMaxDuration;
private int mVideoBitRate;
private int mAudioBitRate;
private boolean mHasFrameProcessors;
private long mAutoFocusResetDelayMillis;
private int mSnapshotMaxWidth = Integer.MAX_VALUE; // in REF_VIEW for consistency with SizeSelectors
private int mSnapshotMaxHeight = Integer.MAX_VALUE; // in REF_VIEW for consistency with SizeSelectors
private int mDisplayOffset;
private int mDeviceOrientation;
// Steps
private final CameraEngineStep.Callback mStepCallback = new CameraEngineStep.Callback() {
@Override @NonNull public Executor getExecutor() { return mHandler.getExecutor(); }
@Override public void handleException(@NonNull Exception exception) {
@ -203,24 +202,17 @@ public abstract class CameraEngine implements
private CameraEngineStep mPreviewStep = new CameraEngineStep("preview", mStepCallback);
private CameraEngineStep mAllStep = new CameraEngineStep("all", mStepCallback);
// Used for testing.
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
Op<Void> mZoomOp = new Op<>();
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
Op<Void> mExposureCorrectionOp = new Op<>();
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
Op<Void> mFlashOp = new Op<>();
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
Op<Void> mWhiteBalanceOp = new Op<>();
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
Op<Void> mHdrOp = new Op<>();
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
Op<Void> mLocationOp = new Op<>();
// Ops used for testing.
@VisibleForTesting Op<Void> mStartVideoOp = new Op<>();
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
Op<Void> mPlaySoundsOp = new Op<>();
protected CameraEngine(Callback callback) {
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) Op<Void> mZoomOp = new Op<>();
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) Op<Void> mExposureCorrectionOp = new Op<>();
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) Op<Void> mFlashOp = new Op<>();
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) Op<Void> mWhiteBalanceOp = new Op<>();
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) Op<Void> mHdrOp = new Op<>();
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) Op<Void> mLocationOp = new Op<>();
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) Op<Void> mPlaySoundsOp = new Op<>();
protected CameraEngine(@NonNull Callback callback) {
mCallback = callback;
mCrashHandler = new Handler(Looper.getMainLooper());
mHandler = WorkerHandler.get("CameraViewEngine");
@ -320,7 +312,7 @@ public abstract class CameraEngine implements
return mBindStep.getState();
}
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "WeakerAccess"})
public final int getPreviewState() {
return mPreviewStep.getState();
}
@ -674,6 +666,7 @@ public abstract class CameraEngine implements
try {
boolean success = latch.await(3, TimeUnit.SECONDS);
if (!success) {
// TODO seems like this is always the case?
LOG.e("Probably some deadlock in destroy.",
"Current thread:", Thread.currentThread(),
"Handler thread: ", mHandler.getThread());
@ -790,13 +783,18 @@ public abstract class CameraEngine implements
//endregion
//region final setters
//region Final setters and getters
// This is called before start() and never again.
public final void setDisplayOffset(int displayOffset) {
mDisplayOffset = displayOffset;
}
@SuppressWarnings("WeakerAccess")
public final int getDisplayOffset() {
return mDisplayOffset;
}
// This can be called multiple times.
public final void setDeviceOrientation(int deviceOrientation) {
mDeviceOrientation = deviceOrientation;
@ -806,44 +804,89 @@ public abstract class CameraEngine implements
mPreviewStreamSizeSelector = selector;
}
@Nullable
public final SizeSelector getPreviewStreamSizeSelector() {
return mPreviewStreamSizeSelector;
}
public final void setPictureSizeSelector(@NonNull SizeSelector selector) {
mPictureSizeSelector = selector;
}
@NonNull
public final SizeSelector getPictureSizeSelector() {
return mPictureSizeSelector;
}
public final void setVideoSizeSelector(@NonNull SizeSelector selector) {
mVideoSizeSelector = selector;
}
@NonNull
public final SizeSelector getVideoSizeSelector() {
return mVideoSizeSelector;
}
public final void setVideoMaxSize(long videoMaxSizeBytes) {
mVideoMaxSize = videoMaxSizeBytes;
}
public final long getVideoMaxSize() {
return mVideoMaxSize;
}
public final void setVideoMaxDuration(int videoMaxDurationMillis) {
mVideoMaxDuration = videoMaxDurationMillis;
}
public final int getVideoMaxDuration() {
return mVideoMaxDuration;
}
public final void setVideoCodec(@NonNull VideoCodec codec) {
mVideoCodec = codec;
}
public final VideoCodec getVideoCodec() {
return mVideoCodec;
}
public final void setVideoBitRate(int videoBitRate) {
mVideoBitRate = videoBitRate;
}
public final int getVideoBitRate() {
return mVideoBitRate;
}
public final void setAudioBitRate(int audioBitRate) {
mAudioBitRate = audioBitRate;
}
public final int getAudioBitRate() {
return mAudioBitRate;
}
public final void setSnapshotMaxWidth(int maxWidth) {
mSnapshotMaxWidth = maxWidth;
}
public int getSnapshotMaxWidth() {
return mSnapshotMaxWidth;
}
public final void setSnapshotMaxHeight(int maxHeight) {
mSnapshotMaxHeight = maxHeight;
}
public int getSnapshotMaxHeight() {
return mSnapshotMaxHeight;
}
public final void setAutoFocusResetDelay(long delayMillis) { mAutoFocusResetDelayMillis = delayMillis; }
public final long getAutoFocusResetDelay() { return mAutoFocusResetDelayMillis; }
/**
* Sets a new facing value. This will restart the session (if there's any)
* so that we can open the new facing camera.
@ -867,6 +910,11 @@ public abstract class CameraEngine implements
}
}
@NonNull
public final Facing getFacing() {
return mFacing;
}
/**
* Sets a new audio value that will be used for video recordings.
* @param audio desired audio
@ -881,6 +929,11 @@ public abstract class CameraEngine implements
}
}
@NonNull
public final Audio getAudio() {
return mAudio;
}
/**
* Sets the desired mode (either picture or video).
* @param mode desired mode.
@ -899,6 +952,64 @@ public abstract class CameraEngine implements
}
}
@NonNull
public final Mode getMode() {
return mMode;
}
@NonNull
public final FrameManager getFrameManager() {
return mFrameManager;
}
@Nullable
public final CameraOptions getCameraOptions() {
return mCameraOptions;
}
@NonNull
public final Flash getFlash() {
return mFlash;
}
@NonNull
public final WhiteBalance getWhiteBalance() {
return mWhiteBalance;
}
@NonNull
public final Hdr getHdr() {
return mHdr;
}
@Nullable
public final Location getLocation() {
return mLocation;
}
public final float getZoomValue() {
return mZoomValue;
}
public final float getExposureCorrectionValue() {
return mExposureCorrectionValue;
}
@CallSuper
public void setHasFrameProcessors(boolean hasFrameProcessors) {
mHasFrameProcessors = hasFrameProcessors;
}
@SuppressWarnings("WeakerAccess")
public final boolean hasFrameProcessors() {
return mHasFrameProcessors;
}
@SuppressWarnings("WeakerAccess")
protected final boolean shouldResetAutoFocus() {
return mAutoFocusResetDelayMillis > 0 && mAutoFocusResetDelayMillis != Long.MAX_VALUE;
}
//endregion
//region Abstract setters and APIs
@ -945,12 +1056,14 @@ public abstract class CameraEngine implements
public abstract void setPlaySounds(boolean playSounds);
public abstract void setHasFrameProcessors(boolean hasFrameProcessors);
//endregion
//region picture and video control
public final boolean isTakingPicture() {
return mPictureRecorder != null;
}
/* not final for tests */
public void takePicture(final @NonNull PictureResult.Stub stub) {
LOG.v("takePicture", "scheduling");
@ -970,7 +1083,7 @@ public abstract class CameraEngine implements
onTakePicture(stub);
}
});
};
}
/**
* The snapshot size is the {@link #getPreviewStreamSize(int)}, but cropped based on the
@ -1014,6 +1127,10 @@ public abstract class CameraEngine implements
}
}
public final boolean isTakingVideo() {
return mVideoRecorder != null && mVideoRecorder.isRecording();
}
public final void takeVideo(final @NonNull VideoResult.Stub stub, final @NonNull File file) {
LOG.v("takeVideo", "scheduling");
mHandler.run(new Runnable() {
@ -1110,120 +1227,6 @@ public abstract class CameraEngine implements
//endregion
//region final getters
@NonNull
public final FrameManager getFrameManager() {
return mFrameManager;
}
@Nullable
public final CameraOptions getCameraOptions() {
return mCameraOptions;
}
@NonNull
public final Facing getFacing() {
return mFacing;
}
@NonNull
public final Flash getFlash() {
return mFlash;
}
@NonNull
public final WhiteBalance getWhiteBalance() {
return mWhiteBalance;
}
public final VideoCodec getVideoCodec() {
return mVideoCodec;
}
public final int getVideoBitRate() {
return mVideoBitRate;
}
public final long getVideoMaxSize() {
return mVideoMaxSize;
}
public final int getVideoMaxDuration() {
return mVideoMaxDuration;
}
@NonNull
public final Mode getMode() {
return mMode;
}
@NonNull
public final Hdr getHdr() {
return mHdr;
}
@Nullable
public final Location getLocation() {
return mLocation;
}
@NonNull
public final Audio getAudio() {
return mAudio;
}
public final int getAudioBitRate() {
return mAudioBitRate;
}
@SuppressWarnings("unused")
@Nullable
@VisibleForTesting
final SizeSelector getPreviewStreamSizeSelector() {
return mPreviewStreamSizeSelector;
}
@SuppressWarnings("unused")
@NonNull
public final SizeSelector getPictureSizeSelector() {
return mPictureSizeSelector;
}
@SuppressWarnings("unused")
@NonNull
public final SizeSelector getVideoSizeSelector() {
return mVideoSizeSelector;
}
public final float getZoomValue() {
return mZoomValue;
}
public final float getExposureCorrectionValue() {
return mExposureCorrectionValue;
}
public final boolean isTakingVideo() {
return mVideoRecorder != null && mVideoRecorder.isRecording();
}
public final boolean isTakingPicture() {
return mPictureRecorder != null;
}
public final long getAutoFocusResetDelay() { return mAutoFocusResetDelayMillis; }
public boolean getHasFrameProcessors() {
return mHasFrameProcessors;
}
//endregion
final boolean shouldResetAutoFocus() {
return mAutoFocusResetDelayMillis > 0 && mAutoFocusResetDelayMillis != Long.MAX_VALUE;
}
//region Orientation utils
private int computeSensorToViewOffset() {

@ -4,7 +4,6 @@ import android.content.Context;
import android.graphics.PointF;
import androidx.annotation.NonNull;
import android.view.MotionEvent;
import android.widget.FrameLayout;
/**
* Base class for gesture finders.
@ -165,4 +164,13 @@ public abstract class GestureFinder {
}
return newValue;
}
/**
* Returns the controller for this finder.
* @return the controller
*/
@NonNull
protected Controller getController() {
return mController;
}
}

Loading…
Cancel
Save