| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -122,23 +122,28 @@ 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 (getLayoutParams().width == LayoutParams.WRAP_CONTENT) { | 
					 | 
					 | 
					 | 
					            if(previewSize != null) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                int height = MeasureSpec.getSize(heightMeasureSpec); | 
					 | 
					 | 
					 | 
					                if (getLayoutParams().width == LayoutParams.WRAP_CONTENT) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                float ratio = (float) height / (float) previewSize.getWidth(); | 
					 | 
					 | 
					 | 
					                    int height = MeasureSpec.getSize(heightMeasureSpec); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                int width = (int) (previewSize.getHeight() * ratio); | 
					 | 
					 | 
					 | 
					                    float ratio = (float) height / (float) previewSize.getWidth(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                super.onMeasure( | 
					 | 
					 | 
					 | 
					                    int width = (int) (previewSize.getHeight() * ratio); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), | 
					 | 
					 | 
					 | 
					                    super.onMeasure( | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        heightMeasureSpec | 
					 | 
					 | 
					 | 
					                            MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ); | 
					 | 
					 | 
					 | 
					                            heightMeasureSpec | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return; | 
					 | 
					 | 
					 | 
					                    ); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } else if (getLayoutParams().height == LayoutParams.WRAP_CONTENT) { | 
					 | 
					 | 
					 | 
					                    return; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                int width = MeasureSpec.getSize(widthMeasureSpec); | 
					 | 
					 | 
					 | 
					                } else if (getLayoutParams().height == LayoutParams.WRAP_CONTENT) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                float ratio = (float) width / (float) previewSize.getHeight(); | 
					 | 
					 | 
					 | 
					                    int width = MeasureSpec.getSize(widthMeasureSpec); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                int height = (int) (previewSize.getWidth() * ratio); | 
					 | 
					 | 
					 | 
					                    float ratio = (float) width / (float) previewSize.getHeight(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                super.onMeasure( | 
					 | 
					 | 
					 | 
					                    int height = (int) (previewSize.getWidth() * ratio); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        widthMeasureSpec, | 
					 | 
					 | 
					 | 
					                    super.onMeasure( | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY) | 
					 | 
					 | 
					 | 
					                            widthMeasureSpec, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ); | 
					 | 
					 | 
					 | 
					                            MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            }else{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                super.onMeasure(widthMeasureSpec, heightMeasureSpec); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return; | 
					 | 
					 | 
					 | 
					                return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |