Improve locking/AutoFocus

pull/580/head
Mattia Iavarone 6 years ago
parent 226b9bbaca
commit e22541d5f3
  1. 7
      cameraview/src/main/java/com/otaliastudios/cameraview/engine/locking/AutoFocus.java

@ -39,8 +39,11 @@ public class AutoFocus extends Parameter {
protected boolean checkShouldSkip(@NonNull CaptureResult lastResult) { protected boolean checkShouldSkip(@NonNull CaptureResult lastResult) {
Integer afState = lastResult.get(CaptureResult.CONTROL_AF_STATE); Integer afState = lastResult.get(CaptureResult.CONTROL_AF_STATE);
boolean afStateOk = afState != null && boolean afStateOk = afState != null &&
(afState == CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED || (afState == CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED
afState == CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED); || afState == CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED
|| afState == CaptureResult.CONTROL_AF_STATE_INACTIVE
|| afState == CaptureResult.CONTROL_AF_STATE_PASSIVE_FOCUSED
|| afState == CaptureResult.CONTROL_AF_STATE_PASSIVE_UNFOCUSED);
Integer afMode = lastResult.get(CaptureResult.CONTROL_AF_MODE); Integer afMode = lastResult.get(CaptureResult.CONTROL_AF_MODE);
boolean afModeOk = afMode != null && afMode == CaptureResult.CONTROL_AF_MODE_AUTO; boolean afModeOk = afMode != null && afMode == CaptureResult.CONTROL_AF_MODE_AUTO;
boolean result = afStateOk && afModeOk; boolean result = afStateOk && afModeOk;

Loading…
Cancel
Save