mirror of
https://github.com/SimpleMobileTools/Simple-Camera.git
synced 2025-01-30 15:04:49 +01:00
schedule autofocusing at app launch
This commit is contained in:
parent
64aec3cf4f
commit
97e72417fa
@ -172,6 +172,7 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
|||||||
mSetupPreviewAfterMeasure = true
|
mSetupPreviewAfterMeasure = true
|
||||||
requestLayout()
|
requestLayout()
|
||||||
invalidate()
|
invalidate()
|
||||||
|
rescheduleAutofocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getSelectedResolution(): Camera.Size {
|
private fun getSelectedResolution(): Camera.Size {
|
||||||
@ -358,11 +359,8 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
|||||||
|
|
||||||
if (takePictureAfter) {
|
if (takePictureAfter) {
|
||||||
takePicture()
|
takePicture()
|
||||||
} else if (!mIsVideoMode || !mIsRecording) {
|
} else {
|
||||||
autoFocusHandler.removeCallbacksAndMessages(null)
|
rescheduleAutofocus()
|
||||||
autoFocusHandler.postDelayed({
|
|
||||||
focusArea(false, false)
|
|
||||||
}, REFOCUS_PERIOD)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ignored: RuntimeException) {
|
} catch (ignored: RuntimeException) {
|
||||||
@ -385,6 +383,15 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
|||||||
return Rect(rectLeft, rectTop, rectRight, rectBottom)
|
return Rect(rectLeft, rectTop, rectRight, rectBottom)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun rescheduleAutofocus() {
|
||||||
|
autoFocusHandler.removeCallbacksAndMessages(null)
|
||||||
|
autoFocusHandler.postDelayed({
|
||||||
|
if (!mIsVideoMode || !mIsRecording) {
|
||||||
|
focusArea(false, false)
|
||||||
|
}
|
||||||
|
}, REFOCUS_PERIOD)
|
||||||
|
}
|
||||||
|
|
||||||
fun showChangeResolutionDialog() {
|
fun showChangeResolutionDialog() {
|
||||||
if (mCamera != null) {
|
if (mCamera != null) {
|
||||||
val oldResolution = getSelectedResolution()
|
val oldResolution = getSelectedResolution()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user