public void StartTouchToFocus(FocusRect rect, FocusRect meteringarea, int width, int height) {
    if (parametersHandler == null
        || cameraUiWrapper == null
        || cameraHolder == null
        || parametersHandler.FocusMode == null) return;

    String focusmode = parametersHandler.FocusMode.GetValue();
    if (focusmode.equals("auto") || focusmode.equals("macro")) {
      try {
        if (parametersHandler.ExposureLock != null
            && parametersHandler.ExposureLock.IsSupported()) {
          if (parametersHandler.ExposureLock.GetValue().equals("true")) {
            parametersHandler.ExposureLock.SetValue("false", true);
            parametersHandler.ExposureLock.BackgroundValueHasChanged("false");
          }
        }
      } catch (Exception ex) {

      }
      final FocusRect targetFocusRect = getFocusRect(rect, width, height);

      if (targetFocusRect.left >= -1000
          && targetFocusRect.top >= -1000
          && targetFocusRect.bottom <= 1000
          && targetFocusRect.right <= 1000) {

        parametersHandler.SetFocusAREA(targetFocusRect, meteringarea);
        if (cameraHolder != null) cameraHolder.StartFocus(this);
        isFocusing = true;
        if (focusEvent != null) focusEvent.FocusStarted(rect);
      }
    }
  }
Beispiel #2
0
 @Override
 public ManualParameterInterface getManualFocusParameter() {
   if (parameters.get(KEYS.MAX_FOCUS_POS_INDEX) != null
       && arrayContainsString(parametersHandler.FocusMode.GetValues(), KEYS.KEY_FOCUS_MODE_MANUAL))
     return new BaseFocusManual(
         parameters,
         KEYS.KEY_MANUAL_FOCUS_POSITION,
         0,
         1000,
         KEYS.KEY_FOCUS_MODE_MANUAL,
         cameraUiWrapper,
         10,
         1);
   return null;
 }