@capgo/camera-preview 6.2.6 → 6.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/android/build.gradle
CHANGED
|
@@ -874,6 +874,18 @@ public class CameraActivity extends Fragment {
|
|
|
874
874
|
) {
|
|
875
875
|
Log.d(TAG, "Requested picture size: " + width + "x" + height);
|
|
876
876
|
Log.d(TAG, "Preview size: " + previewSize.width + "x" + previewSize.height);
|
|
877
|
+
|
|
878
|
+
// If width and height are provided and non-zero, find an exact match
|
|
879
|
+
if (width > 0 && height > 0) {
|
|
880
|
+
for (Camera.Size size : supportedSizes) {
|
|
881
|
+
if (size.width == width && size.height == height) {
|
|
882
|
+
Log.d(TAG, "Exact match found: " + size.width + "x" + size.height);
|
|
883
|
+
return size;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
// If no exact match found, find the optimal size based on aspect ratio and max pixels
|
|
877
889
|
double targetRatio = (double) previewSize.width / previewSize.height;
|
|
878
890
|
Camera.Size optimalSize = null;
|
|
879
891
|
double minDiff = Double.MAX_VALUE;
|