Update CameraView.java

pull/1/head
android-dataticket 8 years ago committed by GitHub
parent 6d65d6f10d
commit e04fb369a6
  1. 5
      camerakit/src/main/java/com/flurgle/camerakit/CameraView.java

@ -122,6 +122,7 @@ public class CameraView extends FrameLayout {
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (mAdjustViewBounds) { if (mAdjustViewBounds) {
Size previewSize = getPreviewSize(); Size previewSize = getPreviewSize();
if(previewSize != null) {
if (getLayoutParams().width == LayoutParams.WRAP_CONTENT) { if (getLayoutParams().width == LayoutParams.WRAP_CONTENT) {
int height = MeasureSpec.getSize(heightMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec);
float ratio = (float) height / (float) previewSize.getWidth(); float ratio = (float) height / (float) previewSize.getWidth();
@ -141,6 +142,10 @@ public class CameraView extends FrameLayout {
); );
return; return;
} }
}else{
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
return;
}
} }
super.onMeasure(widthMeasureSpec, heightMeasureSpec); super.onMeasure(widthMeasureSpec, heightMeasureSpec);

Loading…
Cancel
Save