implement the "Focus before capture" functionality
This commit is contained in:
parent
6ffea6c542
commit
c608407fc1
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue