Remove ExtraProprties

pull/360/head
Mattia Iavarone 7 years ago
parent 49fa18901e
commit eeca06f1da
  1. 3
      README.md
  2. 32
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/ExtraProperties1Test.java
  3. 1
      cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java
  4. 6
      cameraview/src/main/java/com/otaliastudios/cameraview/CameraController.java
  5. 11
      cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java
  6. 39
      cameraview/src/main/java/com/otaliastudios/cameraview/ExtraProperties.java
  7. 0
      cameraview/src/main/utils/com/otaliastudios/cameraview/SizeSelectors.java

@ -623,7 +623,6 @@ Other APIs not mentioned above are provided, and are well documented and comment
|`getGestureAction(Gesture)`|Returns the action currently mapped to the given gesture.|
|`clearGesture(Gesture)`|Clears any action mapped to the given gesture.|
|`getCameraOptions()`|If camera was started, returns non-null object with information about what is supported.|
|`getExtraProperties()`|If camera was started, returns non-null object with extra information about the camera sensor. Not very useful at the moment.|
|`setZoom(float)`, `getZoom()`|Sets a zoom value, where 0 means camera zoomed out and 1 means zoomed in. No-op if zoom is not supported, or camera not started.|
|`setExposureCorrection(float)`, `getExposureCorrection()`|Sets exposure compensation EV value, in camera stops. No-op if this is not supported. Should be between the bounds returned by CameraOptions.|
|`toggleFacing()`|Toggles the facing value between `Facing.FRONT` and `Facing.BACK`.|
@ -635,7 +634,7 @@ Other APIs not mentioned above are provided, and are well documented and comment
|`getSnapshotSize()`|Returns `getPreviewSize()`, since a snapshot is a preview frame.|
|`getPictureSize()`|Returns the size of the output picture. The aspect ratio is consistent with `getPreviewSize()`.|
Take also a look at public methods in `CameraUtils`, `CameraOptions`, `ExtraProperties`.
Take also a look at public methods in `CameraUtils`, `CameraOptions`.
## Permissions behavior

@ -1,32 +0,0 @@
package com.otaliastudios.cameraview;
import android.annotation.TargetApi;
import android.hardware.Camera;
import android.hardware.camera2.CameraCharacteristics;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;
import android.util.SizeF;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import static org.mockito.Mockito.*;
import static org.junit.Assert.*;
@RunWith(AndroidJUnit4.class)
@SmallTest
public class ExtraProperties1Test extends BaseTest {
@Test
public void testConstructor1() {
Camera.Parameters params = mock(Camera.Parameters.class);
when(params.getVerticalViewAngle()).thenReturn(10f);
when(params.getHorizontalViewAngle()).thenReturn(5f);
ExtraProperties e = new ExtraProperties(params);
assertEquals(e.getVerticalViewingAngle(), 10f, 0f);
assertEquals(e.getHorizontalViewingAngle(), 5f, 0f);
}
}

@ -180,7 +180,6 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera
// Set parameters that might have been set before the camera was opened.
LOG.i("onStart:", "Applying default parameters.");
Camera.Parameters params = mCamera.getParameters();
mExtraProperties = new ExtraProperties(params);
mCameraOptions = new CameraOptions(params, shouldFlipSizes());
applyDefaultFocus(params);
mergeFlash(params, Flash.DEFAULT);

@ -49,7 +49,6 @@ abstract class CameraController implements
protected boolean mPlaySounds;
protected int mCameraId;
protected ExtraProperties mExtraProperties;
protected CameraOptions mCameraOptions;
protected Mapper mMapper;
protected FrameManager mFrameManager;
@ -341,11 +340,6 @@ abstract class CameraController implements
//region final getters
@Nullable
final ExtraProperties getExtraProperties() {
return mExtraProperties;
}
@Nullable
final CameraOptions getCameraOptions() {
return mCameraOptions;

@ -687,17 +687,6 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
}
/**
* If present, returns a collection of extra properties from the current camera
* session.
* @return an ExtraProperties object.
*/
@Nullable
public ExtraProperties getExtraProperties() {
return mCameraController.getExtraProperties();
}
/**
* Sets exposure adjustment, in EV stops. A positive value will mean brighter picture.
*

@ -1,39 +0,0 @@
package com.otaliastudios.cameraview;
import android.annotation.TargetApi;
import android.hardware.Camera;
import android.hardware.camera2.CameraCharacteristics;
import android.util.Log;
import android.util.SizeF;
/**
* Simple pojo containing various camera properties.
*/
@SuppressWarnings("deprecation")
public class ExtraProperties {
private float verticalViewingAngle;
private float horizontalViewingAngle;
ExtraProperties(Camera.Parameters params) {
verticalViewingAngle = params.getVerticalViewAngle();
horizontalViewingAngle = params.getHorizontalViewAngle();
}
@TargetApi(21)
ExtraProperties(CameraCharacteristics chars) {
float[] maxFocus = chars.get(CameraCharacteristics.LENS_INFO_AVAILABLE_FOCAL_LENGTHS);
SizeF size = chars.get(CameraCharacteristics.SENSOR_INFO_PHYSICAL_SIZE);
verticalViewingAngle = (float) Math.toDegrees(2 * Math.atan(size.getWidth() / (maxFocus[0] * 2)));
horizontalViewingAngle = (float) Math.toDegrees(2 * Math.atan(size.getHeight() / (maxFocus[0] * 2)));
}
public float getHorizontalViewingAngle() {
return horizontalViewingAngle;
}
public float getVerticalViewingAngle() {
return verticalViewingAngle;
}
}
Loading…
Cancel
Save