soft fix for mismatch preview/capture aspect ratios

pull/1/head
Dylan McIntyre 8 years ago
parent fbb08c7bdd
commit 3bf1a665e7
  1. 8
      camerakit/src/main/api16/com/flurgle/camerakit/Camera1.java
  2. 4
      demo/build.gradle

@ -230,13 +230,13 @@ public class Camera1 extends CameraImpl {
mCameraParameters.getSupportedPreviewSizes(),
mCameraParameters.getSupportedPictureSizes()
);
AspectRatio targetRatio = aspectRatios.last();
AspectRatio targetRatio = aspectRatios.size() > 0 ? aspectRatios.last() : null;
Iterator<Size> descendingSizes = sizes.descendingIterator();
Size size;
while (descendingSizes.hasNext() && mCaptureSize == null) {
size = descendingSizes.next();
if (targetRatio.matches(size)) {
if (targetRatio == null || targetRatio.matches(size)) {
mCaptureSize = size;
break;
}
@ -258,13 +258,13 @@ public class Camera1 extends CameraImpl {
mCameraParameters.getSupportedPreviewSizes(),
mCameraParameters.getSupportedPictureSizes()
);
AspectRatio targetRatio = aspectRatios.last();
AspectRatio targetRatio = aspectRatios.size() > 0 ? aspectRatios.last() : null;
Iterator<Size> descendingSizes = sizes.descendingIterator();
Size size;
while (descendingSizes.hasNext() && mPreviewSize == null) {
size = descendingSizes.next();
if (targetRatio.matches(size)) {
if (targetRatio == null || targetRatio.matches(size)) {
mPreviewSize = size;
break;
}

@ -7,8 +7,8 @@ android {
applicationId "com.flurgle.camerakit.demo"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
versionCode 2
versionName "1.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {

Loading…
Cancel
Save