focus the middle of the screen if no other place was clicked

This commit is contained in:
tibbi 2017-05-07 16:05:29 +02:00
parent 5115739a96
commit 69beac2f55
1 changed files with 5 additions and 1 deletions

View File

@ -322,8 +322,12 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
return return
mCamera!!.cancelAutoFocus() mCamera!!.cancelAutoFocus()
val focusRect = calculateFocusArea(mLastClickX.toFloat(), mLastClickY.toFloat())
if (mParameters!!.maxNumFocusAreas > 0) { if (mParameters!!.maxNumFocusAreas > 0) {
if (mLastClickX == 0 && mLastClickY == 0) {
mLastClickX = width / 2
mLastClickY = height / 2
}
val focusRect = calculateFocusArea(mLastClickX.toFloat(), mLastClickY.toFloat())
val focusAreas = ArrayList<Camera.Area>(1) val focusAreas = ArrayList<Camera.Area>(1)
focusAreas.add(Camera.Area(focusRect, 1000)) focusAreas.add(Camera.Area(focusRect, 1000))
mParameters!!.focusAreas = focusAreas mParameters!!.focusAreas = focusAreas