Example #1
0
 @Override
 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
   if (mVARM.getAspectRatio() > 0 && mAspectRatioMode == ASPECT_RATIO_PREVIEW) {
     mVARM.measure(widthMeasureSpec, heightMeasureSpec);
     setMeasuredDimension(mVARM.getMeasuredWidth(), mVARM.getMeasuredHeight());
   } else {
     super.onMeasure(widthMeasureSpec, heightMeasureSpec);
   }
 }
Example #2
0
 /**
  * Requests a certain aspect ratio for the preview. You don't have to call this yourself, the
  * {@link VideoStream} will do it when it's needed.
  */
 public void requestAspectRatio(double aspectRatio) {
   if (mVARM.getAspectRatio() != aspectRatio) {
     mVARM.setAspectRatio(aspectRatio);
     mHandler.post(
         new Runnable() {
           @Override
           public void run() {
             if (mAspectRatioMode == ASPECT_RATIO_PREVIEW) {
               requestLayout();
             }
           }
         });
   }
 }