implement the "Focus before capture" functionality

This commit is contained in:
tibbi 2017-05-07 11:55:17 +02:00
parent 6ffea6c542
commit c608407fc1
2 changed files with 10 additions and 2 deletions

View File

@ -256,7 +256,15 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
})
}
fun takePicture() {
fun tryTakePicture() {
if (config.focusBeforeCapture) {
focusArea(true)
} else {
takePicture()
}
}
private fun takePicture() {
if (mCanTakePicture) {
val selectedResolution = getSelectedResolution()
mParameters!!.setPictureSize(selectedResolution.width, selectedResolution.height);

View File

@ -269,7 +269,7 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
private fun handleShutter() {
if (mIsInPhotoMode) {
toggleBottomButtons(true)
mPreview?.takePicture()
mPreview?.tryTakePicture()
Handler().postDelayed({
toggleBottomButtons(false)
}, Preview.PHOTO_PREVIEW_LENGTH)