@Override
  public void onReceive(Context context, Intent intent) {
    // Try to get the camera hardware
    CameraHolder holder = CameraHolder.instance();
    ComboPreferences pref = new ComboPreferences(context);
    int cameraId = CameraSettings.readPreferredCameraId(pref);
    if (holder.tryOpen(cameraId) == null) return;

    // We are going to launch the camera, so hold the camera for later use
    holder.keep();
    holder.release();
    Intent i = new Intent(Intent.ACTION_MAIN);
    i.setClass(context, CameraActivity.class);
    i.addCategory(Intent.CATEGORY_LAUNCHER);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    context.startActivity(i);
  }
Esempio n. 2
0
  private void fillSettings(Scene scene) {
    Camera camera = scene.getCamera();

    AbstractCameraProjection projection = camera.getProjection();
    switch (projection.getType()) {
      case PARALLEL:
        parallelButton.setSelection(true);
        perspectiveButton.setSelection(false);
        break;
      case CENTRAL:
        perspectiveButton.setSelection(true);
        parallelButton.setSelection(false);
        break;
    }

    ViewType viewType = controller.getViewType();
    switch (viewType) {
      case POLYGONS:
        fillButton.setSelection(true);
        edgeButton.setSelection(false);
        break;
      case EDGES:
        fillButton.setSelection(false);
        edgeButton.setSelection(true);
        break;
    }

    CameraSettings cameraSettings = camera.getCameraSettings();

    int focalLengthValue = cameraSettings.getFocalLength();
    int horizontalLength = cameraSettings.getHorizontalLength();
    Point3D fromCoordinates = cameraSettings.getFromCoordinates();
    Point3D toCoordinates = cameraSettings.getToCoordinates();
    CameraRotateType rotateType = cameraSettings.getRotateType();
    RotationCoordinates rotationCoordinates = cameraSettings.getRotationCoordinates();

    this.focalLength.setText("" + focalLengthValue);
    focalLengthSlider.setSelection(focalLengthValue);

    this.horizontLength.setText("" + horizontalLength);
    horizontLengthSlider.setSelection(horizontalLength);

    rotateX.setText("" + (int) rotationCoordinates.getX());
    rotateY.setText("" + (int) rotationCoordinates.getY());
    rotateZ.setText("" + (int) rotationCoordinates.getZ());

    rotateXSlider.setSelection((int) rotationCoordinates.getX());
    rotateYSlider.setSelection((int) rotationCoordinates.getY());
    rotateZSlider.setSelection((int) rotationCoordinates.getZ());

    fromX.setText("" + (int) fromCoordinates.getX());
    fromY.setText("" + (int) fromCoordinates.getY());
    fromZ.setText("" + (int) fromCoordinates.getZ());

    toX.setText("" + (int) toCoordinates.getX());
    toY.setText("" + (int) toCoordinates.getY());
    toZ.setText("" + (int) toCoordinates.getZ());

    switch (rotateType) {
      case TO:
        toRotate.setSelection(true);
        break;
      case FROM:
        fromRotate.setSelection(true);
        break;
    }
  }
Esempio n. 3
0
 @Inject
 CameraProvider(@NotNull CameraSettings aSettings) {
   theCamPreviewWidth = aSettings.getCamPreviewWidth();
   theCamPreviewHeight = aSettings.getCamPreviewHeight();
 }