コード例 #1
0
  private void updateCameraParametersPreference() {
    // Set picture size.
    String pictureSize = mPreferences.getString(KEY_PICTURE_SIZE, null);
    if (pictureSize == null) {
      initialCameraPictureSize(this, mParameters);
    } else {
      List<Size> supported = mParameters.getSupportedPictureSizes();
      setCameraPictureSize(pictureSize, supported, mParameters);
    }

    // Set the preview frame aspect ratio according to the picture size.
    Size size = mParameters.getPictureSize();
    PreviewFrameLayout frameLayout = (PreviewFrameLayout) findViewById(R.id.frame_layout);
    frameLayout.setAspectRatio((double) size.width / size.height);

    // Set a preview size that is closest to the viewfinder height and has
    // the right aspect ratio.
    List<Size> sizes = mParameters.getSupportedPreviewSizes();
    Size optimalSize = getOptimalPreviewSize(sizes, (double) size.width / size.height);
    if (optimalSize != null) {
      mParameters.setPreviewSize(optimalSize.width, optimalSize.height);
    }
    mParameters.setJpegQuality(85);
    updateFlashModeParameter();
  }
コード例 #2
0
ファイル: Utils.java プロジェクト: xiaoyangren6514/uai
 public static List<Camera.Size> getResolutionList(Camera camera) {
   Parameters parameters = camera.getParameters();
   List<Camera.Size> previewSizes = parameters.getSupportedPreviewSizes();
   return previewSizes;
 }
コード例 #3
0
 public void setCamera(Camera cameraObj) {
   this.camera = cameraObj;
   Parameters parameters = camera.getParameters();
   supportedPreviewSizes = parameters.getSupportedPreviewSizes();
   requestLayout();
 }