mirror of
https://github.com/SimpleMobileTools/Simple-Camera.git
synced 2025-06-27 09:02:59 +02:00
always set camera state to STATE_PICTURE_TAKEN at capturing
This commit is contained in:
@ -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)
|
||||||
|
Reference in New Issue
Block a user