app/src/main/java/cn/lytcom/camera2kit/Camera2Fragment.java
/**
     * We choose a largest picture size with mAspectRatio
     */
We choose a largest picture size with mAspectRatio
We choose a largest picture size with mAspectRatio
Size choosePictureSize(Size[] choices) {
        List<Size> pictureSizes = Arrays.asList(choices);
        Collections.sort(pictureSizes, new CompareSizesByArea());
        int maxIndex = pictureSizes.size() - 1;
        for (int i = maxIndex; i >= 0; i--) {
            if (pictureSizes.get(i).getWidth() == pictureSizes.get(i).getHeight() *
                mAspectRatio.getX() / mAspectRatio.getY()) {
                return pictureSizes.get(i);
            }
        }
        return pictureSizes.get(maxIndex);
    }
Size choosePictureSize ( Size [ ] choices ) { List < Size > pictureSizes = Arrays . asList ( choices ) ; Collections . sort ( pictureSizes , new CompareSizesByArea ( ) ) ; int maxIndex = pictureSizes . size ( ) - 1 ; for ( int i = maxIndex ; i >= 0 ; i -- ) { if ( pictureSizes . get ( i ) . getWidth ( ) == pictureSizes . get ( i ) . getHeight ( ) * mAspectRatio . getX ( ) / mAspectRatio . getY ( ) ) { return pictureSizes . get ( i ) ; } } return pictureSizes . get ( maxIndex ) ; }
We choose a largest picture size with mAspectRatio
We choose a largest picture size with mAspectRatio