try refocusing the selected area every 3 secs
This commit is contained in:
parent
ca1cb05b93
commit
d59577512f
|
@ -306,7 +306,7 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
|||
mCanTakePicture = true
|
||||
}
|
||||
|
||||
private fun focusArea(takePictureAfter: Boolean) {
|
||||
private fun focusArea(takePictureAfter: Boolean, showFocusRect: Boolean = true) {
|
||||
if (mCamera == null)
|
||||
return
|
||||
|
||||
|
@ -316,6 +316,8 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
|||
val focusAreas = ArrayList<Camera.Area>(1)
|
||||
focusAreas.add(Camera.Area(focusRect, 1000))
|
||||
mParameters!!.focusAreas = focusAreas
|
||||
|
||||
if (showFocusRect)
|
||||
mCallback.drawFocusRect(mLastClickX, mLastClickY)
|
||||
}
|
||||
|
||||
|
@ -329,6 +331,10 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
|||
camera.parameters = mParameters
|
||||
if (takePictureAfter) {
|
||||
takePicture()
|
||||
} else {
|
||||
Handler().postDelayed({
|
||||
focusArea(false, false)
|
||||
}, 3000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue