APISonar


org.fossasia.phimpme.opencamera.Camera.MyDebug.LOG

> org > fossasia > phimpme > opencamera > Camera > MyDebug > LOG
org APIs fossasia APIs phimpme APIs opencamera APIs Camera APIs MyDebug APIs LOG APIs

Example 1
private void setCameraParameters(Camera.Parameters parameters) {
    if (MyDebug.LOG) Log.d(TAG, "setCameraParameters");
    try {
      camera.setParameters(parameters);
      if (MyDebug.LOG) Log.d(TAG, "done");
    } catch (RuntimeException e) {
      // just in case something has gone wrong
      if (MyDebug.LOG) Log.d(TAG, "failed to set parameters");
      e.printStackTrace();
      count_camera_parameters_exception++;
    }
  }
Example 2
public View getPopupButton(String key) {
    if (MyDebug.LOG) {
      Log.d(TAG, "getPopupButton(" + key + "): " + popup_buttons.get(key));
      Log.d(TAG, "this: " + this);
      Log.d(TAG, "popup_buttons: " + popup_buttons);
    }
    return popup_buttons.get(key);
  }
Example 3
private void setFlash(String flash_value) {
    if (MyDebug.LOG) Log.d(TAG, "setFlash() " + flash_value);
    set_flash_value_after_autofocus =
        ""; // this overrides any previously saved setting, for during the startup autofocus
    if (camera_controller == null) {
      if (MyDebug.LOG) Log.d(TAG, "camera not opened!");
      return;
    }
    cancelAutoFocus();
    camera_controller.setFlashValue(flash_value);
  }
Example 4
public void setPreviewDisplay(CameraController camera_controller) {
    if (MyDebug.LOG) Log.d(TAG, "setPreviewDisplay");
    try {
      camera_controller.setPreviewDisplay(this.getHolder());
    } catch (CameraControllerException e) {
      if (MyDebug.LOG) Log.e(TAG, "Failed to set preview display: " + e.getMessage());
      e.printStackTrace();
    }
  }
Example 5
public void setPreviewDisplay(SurfaceHolder holder) throws CameraControllerException {
    if (MyDebug.LOG) {
      Log.d(TAG, "setPreviewDisplay");
      Log.e(TAG, "SurfaceHolder not supported for CameraController2!");
      Log.e(TAG, "Should use setPreviewTexture() instead");
    }
    throw new RuntimeException(); // throw as RuntimeException, as this is a programming error
  }
Example 6
public void updateFlash(String focus_value) {
    if (MyDebug.LOG) Log.d(TAG, "updateFlash(): " + focus_value);
    if (this.phase == PHASE_TAKING_PHOTO && !is_video) {
      // just to be safe - risk of cancelling the autofocus before taking a photo, or otherwise
      // messing things up
      if (MyDebug.LOG) Log.d(TAG, "currently taking a photo");
      return;
    }
    updateFlash(focus_value, true);
  }
Example 7
private boolean updateFlash(String flash_value, boolean save) {
    if (MyDebug.LOG) Log.d(TAG, "updateFlash(): " + flash_value);
    if (supported_flash_values != null) {
      int new_flash_index = supported_flash_values.indexOf(flash_value);
      if (MyDebug.LOG) Log.d(TAG, "new_flash_index: " + new_flash_index);
      if (new_flash_index != -1) {
        updateFlash(new_flash_index, save);
        return true;
      }
    }
    return false;
  }
Example 8
public String updateFocusForVideo() {
    if (MyDebug.LOG) Log.d(TAG, "updateFocusForVideo()");
    String old_focus_mode = null;
    if (this.supported_focus_values != null && camera_controller != null && is_video) {
      if (MyDebug.LOG) Log.d(TAG, "need to change focus mode");
      old_focus_mode = this.getCurrentFocusValue();
      updateFocus(
          "focus_mode_continuous_video",
          true,
          false,
          false); // don't save, as we're just changing focus mode temporarily for the Samsung S5
      // video hack
    }
    return old_focus_mode;
  }
Example 9
public void updateThumbnail(Bitmap thumbnail) {
    if (MyDebug.LOG) Log.d(TAG, "updateThumbnail");
    if (applicationInterface.getThumbnailAnimationPref()) {
      if (MyDebug.LOG) Log.d(TAG, "thumbnail_anim started");
      thumbnail_anim = true;
      thumbnail_anim_start_ms = System.currentTimeMillis();
    }
    Bitmap old_thumbnail = this.last_thumbnail;
    this.last_thumbnail = thumbnail;
    if (old_thumbnail != null) {
      // only recycle after we've set the new thumbnail
      old_thumbnail.recycle();
    }
  }
Example 10
public void setTransform(Matrix matrix) {
    if (MyDebug.LOG) Log.d(TAG, "setting transforms not supported for MySurfaceView");
    throw new RuntimeException();
  }
Example 11
private void updateUseFakePrecaptureMode(String flash_value) {
    if (MyDebug.LOG) Log.d(TAG, "useFakePrecaptureMode: " + flash_value);
    boolean frontscreen_flash =
        flash_value.equals("flash_frontscreen_auto") || flash_value.equals("flash_frontscreen_on");
    if (frontscreen_flash) {
      use_fake_precapture_mode = true;
    } else if (this.want_expo_bracketing) use_fake_precapture_mode = true;
    else {
      use_fake_precapture_mode = use_fake_precapture;
    }
    if (MyDebug.LOG) Log.d(TAG, "use_fake_precapture_mode set to: " + use_fake_precapture_mode);
  }
Example 12
public void setContinuousFocusMoveCallback(ContinuousFocusMoveCallback cb) {
    if (MyDebug.LOG) Log.d(TAG, "setContinuousFocusMoveCallback");
    this.continuous_focus_move_callback = cb;
  }
Example 13
public void setPreviewTexture(SurfaceTexture texture) throws CameraControllerException {
    if (MyDebug.LOG) Log.d(TAG, "setPreviewTexture");
    try {
      camera.setPreviewTexture(texture);
    } catch (IOException e) {
      e.printStackTrace();
      throw new CameraControllerException();
    }
  }
Example 14
public void setPreviewDisplay(SurfaceHolder holder) throws CameraControllerException {
    if (MyDebug.LOG) Log.d(TAG, "setPreviewDisplay");
    try {
      camera.setPreviewDisplay(holder);
    } catch (IOException e) {
      e.printStackTrace();
      throw new CameraControllerException();
    }
  }
Example 15
private String findEntryForValue(String value, int entries_id, int values_id) {
    String[] entries = getResources().getStringArray(entries_id);
    String[] values = getResources().getStringArray(values_id);
    for (int i = 0; i < values.length; i++) {
      if (MyDebug.LOG) Log.d(TAG, "    compare to value: " + values[i]);
      if (value.equals(values[i])) {
        if (MyDebug.LOG) Log.d(TAG, "    found entry: " + i);
        return entries[i];
      }
    }
    return null;
  }
Example 16
public String getParametersString() {
    String string = "";
    try {
      string = this.getParameters().flatten();
    } catch (Exception e) {
      // received a StringIndexOutOfBoundsException from beneath getParameters().flatten() on Google
      // Play!
      if (MyDebug.LOG) Log.e(TAG, "exception from getParameters().flatten()");
      e.printStackTrace();
    }
    return string;
  }
Example 17
public void setPreviewTexture(SurfaceTexture texture) throws CameraControllerException {
    if (MyDebug.LOG) Log.d(TAG, "setPreviewTexture");
    if (this.texture != null) {
      if (MyDebug.LOG) Log.d(TAG, "preview texture already set");
      throw new RuntimeException(); // throw as RuntimeException, as this is a programming error
    }
    this.texture = texture;
  }
Example 18
private boolean updateFocus(String focus_value, boolean quiet, boolean save, boolean auto_focus) {
    if (MyDebug.LOG) Log.d(TAG, "updateFocus(): " + focus_value);
    if (this.supported_focus_values != null) {
      int new_focus_index = supported_focus_values.indexOf(focus_value);
      if (MyDebug.LOG) Log.d(TAG, "new_focus_index: " + new_focus_index);
      if (new_focus_index != -1) {
        updateFocus(new_focus_index, quiet, save, auto_focus);
        return true;
      }
    }
    return false;
  }
Example 19
private void capture(CaptureRequest request) throws CameraAccessException {
    if (MyDebug.LOG) Log.d(TAG, "capture");
    if (camera == null || captureSession == null) {
      if (MyDebug.LOG) Log.d(TAG, "no camera or capture session");
      return;
    }
    captureSession.capture(request, previewCaptureCallback, handler);
  }
Example 20
public boolean onSurfaceTextureDestroyed(SurfaceTexture arg0) {
    if (MyDebug.LOG) Log.d(TAG, "onSurfaceTextureDestroyed()");
    this.set_textureview_size = false;
    this.textureview_w = 0;
    this.textureview_h = 0;
    mySurfaceDestroyed();
    return true;
  }
Example 21
public boolean focusIsVideo() {
    Camera.Parameters parameters = this.getParameters();
    String current_focus_mode = parameters.getFocusMode();
    // getFocusMode() is documented as never returning null, however I've had null pointer
    // exceptions reported in Google Play
    boolean focus_is_video =
        current_focus_mode != null
            && current_focus_mode.equals(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
    if (MyDebug.LOG) {
      Log.d(TAG, "current_focus_mode: " + current_focus_mode);
      Log.d(TAG, "focus_is_video: " + focus_is_video);
    }
    return focus_is_video;
  }
Example 22
private float getExposureCompensationStep() {
    float exposure_step;
    Camera.Parameters parameters = this.getParameters();
    try {
      exposure_step = parameters.getExposureCompensationStep();
    } catch (Exception e) {
      // received a NullPointerException from StringToReal.parseFloat() beneath
      // getExposureCompensationStep() on Google Play!
      if (MyDebug.LOG) Log.e(TAG, "exception from getExposureCompensationStep()");
      e.printStackTrace();
      exposure_step = 1.0f / 3.0f; // make up a typical example
    }
    return exposure_step;
  }
Example 23
public void setLocationInfo(Location location) {
    if (MyDebug.LOG)
      Log.d(TAG, "setLocationInfo: " + location.getLongitude() + " , " + location.getLatitude());
    this.camera_settings.location = location;
  }
Example 24
public void setZoom(int value) {
    Camera.Parameters parameters = this.getParameters();
    if (MyDebug.LOG) Log.d(TAG, "zoom was: " + parameters.getZoom());
    parameters.setZoom(value);
    setCameraParameters(parameters);
  }
Example 25
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
    if (MyDebug.LOG) Log.d(TAG, "surfaceChanged " + w + ", " + h);
    if (holder.getSurface() == null) {
      // preview surface does not exist
      return;
    }
    mySurfaceChanged();
  }