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) {
|
if (mCanTakePicture) {
|
||||||
val selectedResolution = getSelectedResolution()
|
val selectedResolution = getSelectedResolution()
|
||||||
mParameters!!.setPictureSize(selectedResolution.width, selectedResolution.height);
|
mParameters!!.setPictureSize(selectedResolution.width, selectedResolution.height);
|
||||||
|
|
|
@ -269,7 +269,7 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
|
||||||
private fun handleShutter() {
|
private fun handleShutter() {
|
||||||
if (mIsInPhotoMode) {
|
if (mIsInPhotoMode) {
|
||||||
toggleBottomButtons(true)
|
toggleBottomButtons(true)
|
||||||
mPreview?.takePicture()
|
mPreview?.tryTakePicture()
|
||||||
Handler().postDelayed({
|
Handler().postDelayed({
|
||||||
toggleBottomButtons(false)
|
toggleBottomButtons(false)
|
||||||
}, Preview.PHOTO_PREVIEW_LENGTH)
|
}, Preview.PHOTO_PREVIEW_LENGTH)
|
||||||
|
|
Loading…
Reference in New Issue