Пример #1
0
  /**
   * Sets camera auto-focus move callback.
   *
   * @param cb the callback to run
   * @return {@code true} if the operation is supported (i.e. from Jelly Bean), {@code false}
   *     otherwise
   */
  @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
  public boolean setAutoFocusMoveCallback(@Nullable AutoFocusMoveCallback cb) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
      return false;
    }

    synchronized (mCameraLock) {
      if (mCamera != null) {
        CameraAutoFocusMoveCallback autoFocusMoveCallback = null;
        if (cb != null) {
          autoFocusMoveCallback = new CameraAutoFocusMoveCallback();
          autoFocusMoveCallback.mDelegate = cb;
        }
        mCamera.setAutoFocusMoveCallback(autoFocusMoveCallback);
      }
    }

    return true;
  }
 @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
 private void setAutoFocusMoveCallback(android.hardware.Camera camera, Object cb) {
   camera.setAutoFocusMoveCallback((AutoFocusMoveCallback) cb);
 }
 @Override
 public void setAutoFocusMoveCallback(AutoFocusMoveCallback cb) {
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
     camera.setAutoFocusMoveCallback(cb);
   }
 }