try refocusing the selected area every 3 secs

This commit is contained in:
tibbi 2017-05-07 12:09:26 +02:00
parent ca1cb05b93
commit d59577512f
1 changed files with 8 additions and 2 deletions

View File

@ -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)
}
}
}