diff --git a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/.ninja_log b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/.ninja_log index fd6727d4..bb137e27 100644 --- a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/.ninja_log +++ b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/.ninja_log @@ -61,3 +61,6 @@ 4 45 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/CMakeFiles/cmake.verify_globs 5250f1b80cb55465 5 42 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/CMakeFiles/cmake.verify_globs 5250f1b80cb55465 5 34 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/CMakeFiles/cmake.verify_globs 5250f1b80cb55465 +11 81 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/CMakeFiles/cmake.verify_globs 5250f1b80cb55465 +4 35 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/CMakeFiles/cmake.verify_globs 5250f1b80cb55465 +3 31 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/CMakeFiles/cmake.verify_globs 5250f1b80cb55465 diff --git a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/configure_fingerprint.bin b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/configure_fingerprint.bin index 802a6a50..ecaed097 100644 --- a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/configure_fingerprint.bin +++ b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/configure_fingerprint.bin @@ -2,41 +2,41 @@ C/C++ Structured Logg e cC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\additional_project_files.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  æ�¹¨ƒ4Å, Üû—ö‚4d +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ¦�ƪƒ4Å, Üû—ö‚4d b -`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\android_gradle_build.json  æ�¹¨ƒ4û" Şû—ö‚4i +`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\android_gradle_build.json  ¦�ƪƒ4û" Şû—ö‚4i g -eC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\android_gradle_build_mini.json  æ�¹¨ƒ4ï —ü—ö‚4V +eC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\android_gradle_build_mini.json  ¦�ƪƒ4ï —ü—ö‚4V T -RC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build.ninja  æ�¹¨ƒ4œŞ Íø—ö‚4Z +RC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build.ninja  ¦�ƪƒ4œŞ Íø—ö‚4Z X -VC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build.ninja.txt  æ�¹¨ƒ4_ +VC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build.ninja.txt  ¦�ƪƒ4_ ] -[C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build_file_index.txt  æ�¹¨ƒ4� ™ü—ö‚4` +[C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build_file_index.txt  ¦�ƪƒ4� ™ü—ö‚4` ^ -\C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\compile_commands.json  æ�¹¨ƒ4‘Ø Ëø—ö‚4d +\C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\compile_commands.json  ¦�ƪƒ4‘Ø Ëø—ö‚4d b -`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\compile_commands.json.bin  æ�¹¨ƒ4 Ê„ Ëø—ö‚4j +`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\compile_commands.json.bin  ¦�ƪƒ4 Ê„ Ëø—ö‚4j h -fC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\metadata_generation_command.txt  æ�¹¨ƒ4 +fC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\metadata_generation_command.txt  ¦�ƪƒ4 ¸ ˜ü—ö‚4] [ -YC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\prefab_config.json  æ�¹¨ƒ4 € ˜ü—ö‚4b +YC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\prefab_config.json  ¦�ƪƒ4 € ˜ü—ö‚4b ` -^C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\symbol_folder_index.txt  æ�¹¨ƒ4  ] ˜ü—ö‚4{ +^C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\symbol_folder_index.txt  ¦�ƪƒ4  ] ˜ü—ö‚4{ y -wC:\GitHub\Schnappix\node_modules\react-native-gesture-handler\android\build\generated\source\codegen\jni\CMakeLists.txt  æ�¹¨ƒ4 ¾ ‡•‚ö‚4v +wC:\GitHub\Schnappix\node_modules\react-native-gesture-handler\android\build\generated\source\codegen\jni\CMakeLists.txt  ¦�ƪƒ4 ¾ ‡•‚ö‚4v t -rC:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\generated\source\codegen\jni\CMakeLists.txt  æ�¹¨ƒ4ö ’•‚ö‚4µ +rC:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\generated\source\codegen\jni\CMakeLists.txt  ¦�ƪƒ4ö ’•‚ö‚4µ ² -¯C:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  æ�¹¨ƒ4Y +¯C:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  ¦�ƪƒ4Y W -UC:\GitHub\Schnappix\node_modules\react-native-svg\android\src\main\jni\CMakeLists.txt  æ�¹¨ƒ4½ œ§ØÖç3u +UC:\GitHub\Schnappix\node_modules\react-native-svg\android\src\main\jni\CMakeLists.txt  ¦�ƪƒ4½ œ§ØÖç3u s -qC:\GitHub\Schnappix\node_modules\react-native-view-shot\android\build\generated\source\codegen\jni\CMakeLists.txt  æ�¹¨ƒ4ê û”‚ö‚4t +qC:\GitHub\Schnappix\node_modules\react-native-view-shot\android\build\generated\source\codegen\jni\CMakeLists.txt  ¦�ƪƒ4ê û”‚ö‚4t r -pC:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\generated\source\codegen\jni\CMakeLists.txt  æ�¹¨ƒ4ê Ÿ•‚ö‚4³ +pC:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\generated\source\codegen\jni\CMakeLists.txt  ¦�ƪƒ4ê Ÿ•‚ö‚4³ ° -­C:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  æ�¹¨ƒ4k +­C:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  ¦�ƪƒ4k i -gC:\GitHub\Schnappix\node_modules\react-native\ReactAndroid\cmake-utils\default-app-setup\CMakeLists.txt  æ�¹¨ƒ4ğ ®¡ÈÑç3 \ No newline at end of file +gC:\GitHub\Schnappix\node_modules\react-native\ReactAndroid\cmake-utils\default-app-setup\CMakeLists.txt  ¦�ƪƒ4ğ ®¡ÈÑç3 \ No newline at end of file diff --git a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/.ninja_log b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/.ninja_log index 94f2749b..9a6d800e 100644 --- a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/.ninja_log +++ b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/.ninja_log @@ -61,3 +61,6 @@ 5 45 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/CMakeFiles/cmake.verify_globs 1eb2d1da6ebc2e74 4 35 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/CMakeFiles/cmake.verify_globs 1eb2d1da6ebc2e74 3 33 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/CMakeFiles/cmake.verify_globs 1eb2d1da6ebc2e74 +4 79 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/CMakeFiles/cmake.verify_globs 1eb2d1da6ebc2e74 +5 47 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/CMakeFiles/cmake.verify_globs 1eb2d1da6ebc2e74 +3 29 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/CMakeFiles/cmake.verify_globs 1eb2d1da6ebc2e74 diff --git a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/configure_fingerprint.bin b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/configure_fingerprint.bin index 3a782c46..e5a4fdc6 100644 --- a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/configure_fingerprint.bin +++ b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/configure_fingerprint.bin @@ -2,41 +2,41 @@ C/C++ Structured Logi g eC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\additional_project_files.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  »Ÿ¹¨ƒ4ı, Óì™ö‚4f +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  â�ƪƒ4ı, Óì™ö‚4f d -bC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\android_gradle_build.json  »Ÿ¹¨ƒ4�# Øì™ö‚4k +bC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\android_gradle_build.json  â�ƪƒ4�# Øì™ö‚4k i -gC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\android_gradle_build_mini.json  »Ÿ¹¨ƒ4‘ ˆí™ö‚4X +gC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\android_gradle_build_mini.json  â�ƪƒ4‘ ˆí™ö‚4X V -TC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build.ninja  »Ÿ¹¨ƒ4Áå  é™ö‚4\ +TC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build.ninja  â�ƪƒ4Áå  é™ö‚4\ Z -XC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build.ninja.txt  »Ÿ¹¨ƒ4a +XC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build.ninja.txt  â�ƪƒ4a _ -]C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build_file_index.txt  »Ÿ¹¨ƒ4� �í™ö‚4b +]C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build_file_index.txt  â�ƪƒ4� �í™ö‚4b ` -^C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\compile_commands.json  »Ÿ¹¨ƒ4´à �é™ö‚4f +^C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\compile_commands.json  â�ƪƒ4´à �é™ö‚4f d -bC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\compile_commands.json.bin  »Ÿ¹¨ƒ4 ò„ �é™ö‚4l +bC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\compile_commands.json.bin  â�ƪƒ4 ò„ �é™ö‚4l j -hC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\metadata_generation_command.txt  »Ÿ¹¨ƒ4 +hC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\metadata_generation_command.txt  â�ƪƒ4 Ä Ší™ö‚4_ ] -[C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\prefab_config.json  »Ÿ¹¨ƒ4 € ‹í™ö‚4d +[C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\prefab_config.json  â�ƪƒ4 € ‹í™ö‚4d b -`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\symbol_folder_index.txt  »Ÿ¹¨ƒ4  _ Œí™ö‚4{ +`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\symbol_folder_index.txt  â�ƪƒ4  _ Œí™ö‚4{ y -wC:\GitHub\Schnappix\node_modules\react-native-gesture-handler\android\build\generated\source\codegen\jni\CMakeLists.txt  »Ÿ¹¨ƒ4 ¾ ‡•‚ö‚4v +wC:\GitHub\Schnappix\node_modules\react-native-gesture-handler\android\build\generated\source\codegen\jni\CMakeLists.txt  â�ƪƒ4 ¾ ‡•‚ö‚4v t -rC:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\generated\source\codegen\jni\CMakeLists.txt  »Ÿ¹¨ƒ4ö ’•‚ö‚4µ +rC:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\generated\source\codegen\jni\CMakeLists.txt  â�ƪƒ4ö ’•‚ö‚4µ ² -¯C:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  »Ÿ¹¨ƒ4Y +¯C:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  â�ƪƒ4Y W -UC:\GitHub\Schnappix\node_modules\react-native-svg\android\src\main\jni\CMakeLists.txt  »Ÿ¹¨ƒ4½ œ§ØÖç3u +UC:\GitHub\Schnappix\node_modules\react-native-svg\android\src\main\jni\CMakeLists.txt  â�ƪƒ4½ œ§ØÖç3u s -qC:\GitHub\Schnappix\node_modules\react-native-view-shot\android\build\generated\source\codegen\jni\CMakeLists.txt  »Ÿ¹¨ƒ4ê û”‚ö‚4t +qC:\GitHub\Schnappix\node_modules\react-native-view-shot\android\build\generated\source\codegen\jni\CMakeLists.txt  â�ƪƒ4ê û”‚ö‚4t r -pC:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\generated\source\codegen\jni\CMakeLists.txt  »Ÿ¹¨ƒ4ê Ÿ•‚ö‚4³ +pC:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\generated\source\codegen\jni\CMakeLists.txt  â�ƪƒ4ê Ÿ•‚ö‚4³ ° -­C:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  »Ÿ¹¨ƒ4k +­C:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  â�ƪƒ4k i -gC:\GitHub\Schnappix\node_modules\react-native\ReactAndroid\cmake-utils\default-app-setup\CMakeLists.txt  »Ÿ¹¨ƒ4ğ ®¡ÈÑç3 \ No newline at end of file +gC:\GitHub\Schnappix\node_modules\react-native\ReactAndroid\cmake-utils\default-app-setup\CMakeLists.txt  â�ƪƒ4ğ ®¡ÈÑç3 \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index 425bf73c..0e7b6243 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 68 - versionName "23.01.68" + versionCode 69 + versionName "23.01.69" buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\"" } diff --git a/apks/Schnappix_v23.01.69.aab b/apks/Schnappix_v23.01.69.aab new file mode 100644 index 00000000..c9d1ec28 Binary files /dev/null and b/apks/Schnappix_v23.01.69.aab differ diff --git a/apks/Schnappix_v23.01.69.apk b/apks/Schnappix_v23.01.69.apk new file mode 100644 index 00000000..0c193666 --- /dev/null +++ b/apks/Schnappix_v23.01.69.apk @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed3e9ec0a0c1f005782bb9e049534ad21c186b8832e83287da8c8df99e888418 +size 115456642 diff --git a/app.json b/app.json index f795d7f0..b6d16527 100644 --- a/app.json +++ b/app.json @@ -3,7 +3,7 @@ "newArchEnabled": true, "name": "Schnappix", "slug": "Schnappix", - "version": "23.01.68", + "version": "23.01.69", "orientation": "landscape", "icon": "./Icon.png", "userInterfaceStyle": "dark", @@ -13,7 +13,7 @@ }, "android": { "package": "de.orfel.schnappix", - "versionCode": 68, + "versionCode": 69, "usesCleartextTraffic": true, "adaptiveIcon": { "backgroundColor": "#050510", @@ -75,4 +75,4 @@ } } } -} +} \ No newline at end of file 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 b3556ae5..60a102c8 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 @@ -12,6 +12,10 @@ import expo.modules.kotlin.views.ExpoView import expo.modules.kotlin.AppContext import expo.modules.kotlin.Promise +import com.jiangdg.ausbc.widget.IAspectRatio +import android.view.Surface +import android.view.TextureView + import expo.modules.kotlin.viewevent.EventDispatcher import androidx.annotation.Keep import androidx.lifecycle.Lifecycle @@ -95,6 +99,66 @@ class UsbContextWrapper(base: Context) : android.content.ContextWrapper(base), L } } +@Keep +class CenterCropTextureView(context: Context) : TextureView(context), IAspectRatio { + // We expect the camera to be 1920x1080 (16:9). We hardcode the initial aspect ratio + // to prevent the first layout pass from stretching the image into the container. + private var customAspectRatio = 1920.0 / 1080.0 + + override fun setAspectRatio(width: Int, height: Int) { + post { + val ratio = width.toDouble() / height + if (customAspectRatio != ratio) { + customAspectRatio = ratio + requestLayout() + } + } + } + + override fun getSurfaceWidth(): Int = width + + override fun getSurfaceHeight(): Int = height + + override fun getSurface(): Surface? { + return try { + Surface(surfaceTexture) + } catch (e: Exception) { + null + } + } + + override fun postUITask(task: () -> Unit) { + post { + task() + } + } + + override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { + var initialWidth = MeasureSpec.getSize(widthMeasureSpec) + var initialHeight = MeasureSpec.getSize(heightMeasureSpec) + + if (customAspectRatio > 0) { + val viewAspectRatio = initialWidth.toDouble() / initialHeight + val diff = customAspectRatio / viewAspectRatio - 1 + + // To achieve "Center Crop" behavior instead of "Center Inside" (letterbox): + if (diff > 0) { + // Camera aspect ratio is wider than view (e.g. 16:9 camera on a 3:2 screen). + // To crop, we must match the view's height and expand the width beyond the screen. + initialWidth = (initialHeight * customAspectRatio).toInt() + } else { + // Camera aspect ratio is taller than view (e.g. 4:3 camera on a 16:9 screen). + // To crop, we must match the view's width and expand the height beyond the screen. + initialHeight = (initialWidth / customAspectRatio).toInt() + } + } + + val wMeasureSpec = MeasureSpec.makeMeasureSpec(initialWidth, MeasureSpec.EXACTLY) + val hMeasureSpec = MeasureSpec.makeMeasureSpec(initialHeight, MeasureSpec.EXACTLY) + super.onMeasure(wMeasureSpec, hMeasureSpec) + } +} + @Keep class UsbCameraView(context: Context, appContext: AppContext) : ExpoView(context, appContext) { companion object { @@ -102,7 +166,7 @@ class UsbCameraView(context: Context, appContext: AppContext) : ExpoView(context var sharedSafeContext: UsbContextWrapperJava? = null } - private var textureView: AspectRatioTextureView + private var textureView: CenterCropTextureView private val onCameraReady by EventDispatcher() private val onCameraError by EventDispatcher() @@ -129,7 +193,7 @@ class UsbCameraView(context: Context, appContext: AppContext) : ExpoView(context } val safeContextVal = sharedSafeContext!! - textureView = AspectRatioTextureView(safeContextVal) + textureView = CenterCropTextureView(safeContextVal) val layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT) layoutParams.gravity = android.view.Gravity.CENTER addView(textureView, layoutParams) diff --git a/package.json b/package.json index e81b017c..85457e12 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "schnappix", - "version": "23.01.68", + "version": "23.01.69", "main": "index.ts", "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.7.2", @@ -41,4 +41,4 @@ "web": "expo start --web" }, "private": true -} +} \ No newline at end of file