always set camera state to STATE_PICTURE_TAKEN at capturing
This commit is contained in:
parent
27fb68704b
commit
410822bd38
|
@ -279,13 +279,12 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
|
||||||
private fun process(result: CaptureResult) {
|
private fun process(result: CaptureResult) {
|
||||||
when (mCameraState) {
|
when (mCameraState) {
|
||||||
STATE_WAITING_LOCK -> {
|
STATE_WAITING_LOCK -> {
|
||||||
val afState = result.get(CaptureResult.CONTROL_AF_STATE)
|
val autoFocusState = result.get(CaptureResult.CONTROL_AF_STATE)
|
||||||
if (afState == null) {
|
if (autoFocusState == null) {
|
||||||
captureStillPicture()
|
captureStillPicture()
|
||||||
} else if (afState == CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED || afState == CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED) {
|
} else if (autoFocusState == CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED || autoFocusState == CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED) {
|
||||||
val aeState = result.get(CaptureResult.CONTROL_AE_STATE)
|
val aeState = result.get(CaptureResult.CONTROL_AE_STATE)
|
||||||
if (aeState == null || aeState == CaptureResult.CONTROL_AE_STATE_CONVERGED) {
|
if (aeState == null || aeState == CaptureResult.CONTROL_AE_STATE_CONVERGED) {
|
||||||
mCameraState = STATE_PICTURE_TAKEN
|
|
||||||
captureStillPicture()
|
captureStillPicture()
|
||||||
} else {
|
} else {
|
||||||
runPrecaptureSequence()
|
runPrecaptureSequence()
|
||||||
|
@ -301,7 +300,6 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
|
||||||
STATE_WAITING_NON_PRECAPTURE -> {
|
STATE_WAITING_NON_PRECAPTURE -> {
|
||||||
val aeState = result.get(CaptureResult.CONTROL_AE_STATE)
|
val aeState = result.get(CaptureResult.CONTROL_AE_STATE)
|
||||||
if (aeState == null || aeState != CaptureResult.CONTROL_AE_STATE_PRECAPTURE) {
|
if (aeState == null || aeState != CaptureResult.CONTROL_AE_STATE_PRECAPTURE) {
|
||||||
mCameraState = STATE_PICTURE_TAKEN
|
|
||||||
captureStillPicture()
|
captureStillPicture()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -332,6 +330,7 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mCameraState = STATE_PICTURE_TAKEN
|
||||||
mRotationAtCapture = mActivity.mLastHandledOrientation
|
mRotationAtCapture = mActivity.mLastHandledOrientation
|
||||||
val captureBuilder = mCameraDevice!!.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE).apply {
|
val captureBuilder = mCameraDevice!!.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE).apply {
|
||||||
addTarget(mImageReader!!.surface)
|
addTarget(mImageReader!!.surface)
|
||||||
|
|
Loading…
Reference in New Issue