diff --git a/android/app/build.gradle b/android/app/build.gradle index 11662e02..c5bac30e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -92,8 +92,8 @@ android { applicationId 'de.orfel.schnappix' minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 70 - versionName "23.01.70" + versionCode 71 + versionName "23.01.71" buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\"" } diff --git a/apks/Schnappix_v23.01.71.aab b/apks/Schnappix_v23.01.71.aab new file mode 100644 index 00000000..354bc2df Binary files /dev/null and b/apks/Schnappix_v23.01.71.aab differ diff --git a/apks/Schnappix_v23.01.71.apk b/apks/Schnappix_v23.01.71.apk new file mode 100644 index 00000000..5f43985b --- /dev/null +++ b/apks/Schnappix_v23.01.71.apk @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a17939f83a056d7de63d055558b0ad0f3b3f378c25aeea3c1116604c742bb99 +size 115456642 diff --git a/app.json b/app.json index 01759726..192f7f9e 100644 --- a/app.json +++ b/app.json @@ -3,7 +3,7 @@ "newArchEnabled": true, "name": "Schnappix", "slug": "Schnappix", - "version": "23.01.70", + "version": "23.01.71", "orientation": "landscape", "icon": "./Icon.png", "userInterfaceStyle": "dark", @@ -13,7 +13,7 @@ }, "android": { "package": "de.orfel.schnappix", - "versionCode": 70, + "versionCode": 71, "usesCleartextTraffic": true, "adaptiveIcon": { "backgroundColor": "#050510", diff --git a/modules/usb-camera/android/src/main/java/expo/modules/usbcamera/UsbCameraView.kt b/modules/usb-camera/android/src/main/java/expo/modules/usbcamera/UsbCameraView.kt index 6791bd3e..9f203815 100644 --- a/modules/usb-camera/android/src/main/java/expo/modules/usbcamera/UsbCameraView.kt +++ b/modules/usb-camera/android/src/main/java/expo/modules/usbcamera/UsbCameraView.kt @@ -149,11 +149,27 @@ class UsbCameraView(context: Context, appContext: AppContext) : ExpoView(context val viewH = (bottom - top).toFloat() if (viewW > 0 && viewH > 0 && parentW > 0 && parentH > 0) { - val scaleX = parentW / viewW - val scaleY = parentH / viewH - val maxScale = kotlin.math.max(scaleX, scaleY) - v.scaleX = maxScale - v.scaleY = maxScale + // The camera stream is 1920x1080 (16:9). + val cameraAspectRatio = 1920f / 1080f + + // Calculate the target dimensions to maintain the camera aspect ratio + // while completely covering the parent (Center Crop). + var targetW = parentH * cameraAspectRatio + var targetH = parentH + + if (targetW < parentW) { + targetW = parentW + targetH = parentW / cameraAspectRatio + } + + // If the texture view was forced to match parent by layout manager, + // it might be distorted. The independent scaleX and scaleY factors + // will simultaneously fix any distortion and apply the crop. + val scaleX = targetW / viewW + val scaleY = targetH / viewH + + v.scaleX = scaleX + v.scaleY = scaleY } } try { diff --git a/package.json b/package.json index 82315f1a..7f3b1a59 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "schnappix", - "version": "23.01.70", + "version": "23.01.71", "main": "index.ts", "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.7.2",