From 0965990c133618b8f451d6732b5fd68cc40a8ac3 Mon Sep 17 00:00:00 2001 From: Alpar Szotyori Date: Thu, 14 Sep 2023 17:51:46 +0200 Subject: [PATCH] refactor(capture-sdk): Rename `ocr` package to `textrecognition` PIA-4354 --- .../gini/android/capture/camera/CameraFragmentImpl.java | 8 ++++---- .../internal/{ocr => textrecognition}/IBANFilter.kt | 4 ++-- .../capture/internal/{ocr => textrecognition}/OCR.kt | 5 +---- .../capture/internal/{ocr => textrecognition}/OCRText.kt | 3 +-- .../capture/internal/{ocr => textrecognition}/OCRView.kt | 4 +--- 5 files changed, 9 insertions(+), 15 deletions(-) rename capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/{ocr => textrecognition}/IBANFilter.kt (91%) rename capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/{ocr => textrecognition}/OCR.kt (94%) rename capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/{ocr => textrecognition}/OCRText.kt (74%) rename capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/{ocr => textrecognition}/OCRView.kt (96%) diff --git a/capture-sdk/sdk/src/main/java/net/gini/android/capture/camera/CameraFragmentImpl.java b/capture-sdk/sdk/src/main/java/net/gini/android/capture/camera/CameraFragmentImpl.java index b2cd0e8526..dce2b05186 100644 --- a/capture-sdk/sdk/src/main/java/net/gini/android/capture/camera/CameraFragmentImpl.java +++ b/capture-sdk/sdk/src/main/java/net/gini/android/capture/camera/CameraFragmentImpl.java @@ -51,10 +51,10 @@ import net.gini.android.capture.internal.network.AnalysisNetworkRequestResult; import net.gini.android.capture.internal.network.FailureException; import net.gini.android.capture.internal.network.NetworkRequestsManager; -import net.gini.android.capture.internal.ocr.IBANFilter; -import net.gini.android.capture.internal.ocr.OCR; -import net.gini.android.capture.internal.ocr.OCRText; -import net.gini.android.capture.internal.ocr.OCRView; +import net.gini.android.capture.internal.textrecognition.IBANFilter; +import net.gini.android.capture.internal.textrecognition.OCR; +import net.gini.android.capture.internal.textrecognition.OCRText; +import net.gini.android.capture.internal.textrecognition.OCRView; import net.gini.android.capture.internal.qrcode.PaymentQRCodeData; import net.gini.android.capture.internal.qrcode.PaymentQRCodeReader; import net.gini.android.capture.internal.qrcode.QRCodeDetectorTask; diff --git a/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/ocr/IBANFilter.kt b/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/textrecognition/IBANFilter.kt similarity index 91% rename from capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/ocr/IBANFilter.kt rename to capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/textrecognition/IBANFilter.kt index 47729e24dd..5afc86a142 100644 --- a/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/ocr/IBANFilter.kt +++ b/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/textrecognition/IBANFilter.kt @@ -1,4 +1,4 @@ -package net.gini.android.capture.internal.ocr +package net.gini.android.capture.internal.textrecognition import android.graphics.Rect import android.util.Log @@ -13,7 +13,7 @@ class IBANFilter { private val ibanValidator: IBANValidator = IBANValidator() - private val ibanRegex = """[A-Z]{2}\d{2}.*\d""".toRegex() + private val ibanRegex = Regex("[A-Z]{2}[0-9]{2}[A-Z0-9]{1,30}") fun process(text: OCRText): OCRText { return OCRText(text.elements.map { element -> diff --git a/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/ocr/OCR.kt b/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/textrecognition/OCR.kt similarity index 94% rename from capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/ocr/OCR.kt rename to capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/textrecognition/OCR.kt index dda4c654a6..9afdc4bb78 100644 --- a/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/ocr/OCR.kt +++ b/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/textrecognition/OCR.kt @@ -1,4 +1,4 @@ -package net.gini.android.capture.internal.ocr +package net.gini.android.capture.internal.textrecognition import android.graphics.Rect import android.media.Image @@ -7,11 +7,8 @@ import com.google.mlkit.vision.common.InputImage import com.google.mlkit.vision.text.Text import com.google.mlkit.vision.text.TextRecognition import com.google.mlkit.vision.text.latin.TextRecognizerOptions -import kotlinx.coroutines.CoroutineDispatcher -import kotlinx.coroutines.Dispatchers import org.slf4j.Logger import org.slf4j.LoggerFactory -import java.util.concurrent.Executors /** * Created by Alpár Szotyori on 27.04.23. diff --git a/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/ocr/OCRText.kt b/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/textrecognition/OCRText.kt similarity index 74% rename from capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/ocr/OCRText.kt rename to capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/textrecognition/OCRText.kt index 42f73a53fa..f414a2f9f7 100644 --- a/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/ocr/OCRText.kt +++ b/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/textrecognition/OCRText.kt @@ -1,6 +1,5 @@ -package net.gini.android.capture.internal.ocr +package net.gini.android.capture.internal.textrecognition -import android.graphics.Point import android.graphics.Rect /** diff --git a/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/ocr/OCRView.kt b/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/textrecognition/OCRView.kt similarity index 96% rename from capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/ocr/OCRView.kt rename to capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/textrecognition/OCRView.kt index 38c22632c0..9bfd095206 100644 --- a/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/ocr/OCRView.kt +++ b/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/textrecognition/OCRView.kt @@ -1,13 +1,11 @@ -package net.gini.android.capture.internal.ocr +package net.gini.android.capture.internal.textrecognition import android.content.Context import android.graphics.Canvas import android.graphics.Color import android.graphics.Paint -import android.graphics.Path import android.graphics.Rect import android.util.AttributeSet -import android.util.Log import android.view.View import net.gini.android.capture.internal.util.Size