Skip to content

Commit

Permalink
Fix focus camera call once
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Junqueira authored and Andre Junqueira committed Jul 18, 2018
1 parent e2c4339 commit 3298f67
Showing 1 changed file with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -561,20 +561,23 @@ public boolean requestPicture() {
if (safeToTakePicture) {

safeToTakePicture = false;

try{
if(pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_AUTOFOCUS)){
mCamera.autoFocus(new Camera.AutoFocusCallback() {
@Override
public void onAutoFocus(boolean success, Camera camera) {
if (attemptToFocus) {
return;
} else {
attemptToFocus = true;
}
mCamera.takePicture(null, null, pCallback);
}
});
mCamera.takePicture(null, null, pCallback);
//AutoFocus callback is not working, for this reason was commented --- Fix in the future
// mCamera.autoFocus(new Camera.AutoFocusCallback() {
// @Override
// public void onAutoFocus(boolean success, Camera camera) {
// Log.d("TAKE_PICTURE","takePicture: 0.2");
// if (attemptToFocus) {
// return;
// } else {
// attemptToFocus = true;
// }
// mCamera.takePicture(null, null, pCallback);
// Log.d("TAKE_PICTURE","takePicture: 1");
// }
// });
}else{
mCamera.takePicture(null, null, pCallback);
}
Expand Down

0 comments on commit 3298f67

Please sign in to comment.