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 16180e9588..4f63ec07ce 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 @@ -20,7 +20,6 @@ import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; -import android.widget.Toast; import net.gini.android.capture.AsyncCallback; import net.gini.android.capture.Document; @@ -38,6 +37,7 @@ import net.gini.android.capture.document.ImageMultiPageDocument; import net.gini.android.capture.document.QRCodeDocument; import net.gini.android.capture.error.ErrorActivity; +import net.gini.android.capture.error.ErrorType; import net.gini.android.capture.help.HelpActivity; import net.gini.android.capture.internal.camera.api.CameraException; import net.gini.android.capture.internal.camera.api.CameraInterface; @@ -49,6 +49,7 @@ import net.gini.android.capture.internal.camera.view.QRCodePopup; import net.gini.android.capture.internal.fileimport.FileChooserActivity; 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.qrcode.PaymentQRCodeData; import net.gini.android.capture.internal.qrcode.PaymentQRCodeReader; @@ -69,8 +70,6 @@ import net.gini.android.capture.logging.ErrorLog; import net.gini.android.capture.logging.ErrorLogger; import net.gini.android.capture.network.Error; -import net.gini.android.capture.error.ErrorType; -import net.gini.android.capture.internal.network.FailureException; import net.gini.android.capture.network.model.GiniCaptureExtraction; import net.gini.android.capture.network.model.GiniCaptureSpecificExtraction; import net.gini.android.capture.requirements.CameraHolder; @@ -101,7 +100,6 @@ import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.Group; import androidx.core.content.ContextCompat; - import jersey.repackaged.jsr166e.CompletableFuture; import kotlin.Unit; @@ -580,7 +578,6 @@ void onSaveInstanceState(@NonNull final Bundle outState) { void onStop() { closeCamera(); - if (mPaymentQRCodePopup != null) { mPaymentQRCodePopup.hide(); } @@ -1334,7 +1331,7 @@ private void showInvalidFileAlert(final String message) { mFragment.showAlertDialog(message, activity.getString(R.string.gc_document_import_close_error), - (dialogInterface, i) -> dialogInterface.dismiss() , null, null, null); + (dialogInterface, i) -> dialogInterface.dismiss(), null, null, null); } @UiThread diff --git a/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/camera/view/QRCodePopup.kt b/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/camera/view/QRCodePopup.kt index 4ae4b86834..81cf37b030 100644 --- a/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/camera/view/QRCodePopup.kt +++ b/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/camera/view/QRCodePopup.kt @@ -76,7 +76,6 @@ internal class QRCodePopup @JvmOverloads constructor( fragmentImplCallback.view?.postDelayed(hideRunnable, hideDelayMs) return } - isShown = true showViews() fragmentImplCallback.view?.removeCallbacks(hideRunnable) fragmentImplCallback.view?.postDelayed(hideRunnable, hideDelayMs) @@ -124,7 +123,6 @@ internal class QRCodePopup @JvmOverloads constructor( } private fun progressViews() { - qrCheckImage.visibility = View.GONE qrImageFrame.visibility = View.INVISIBLE loadingIndicatorContainer?.modifyAdapterIfOwned { it.onVisible() } @@ -133,7 +131,6 @@ internal class QRCodePopup @JvmOverloads constructor( } private fun hideViews() { - qrStatusTxt.visibility = View.GONE qrCheckImage.visibility = View.GONE qrImageFrame.visibility = View.VISIBLE diff --git a/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/qrcode/PaymentQRCodeReader.java b/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/qrcode/PaymentQRCodeReader.java index 1c91000066..b7b8b70b74 100644 --- a/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/qrcode/PaymentQRCodeReader.java +++ b/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/qrcode/PaymentQRCodeReader.java @@ -43,6 +43,7 @@ public void onNonPaymentQRCodeDetected(@NonNull final String qrCodeContent) { public void onQRCodeReaderFail() { } }; + private boolean isReleased = false; /** * Create a new instance which uses the provided {@link QRCodeDetectorTask} to do QRCode @@ -66,6 +67,9 @@ private PaymentQRCodeReader( mDetector.setListener(new QRCodeDetector.Listener() { @Override public void onQRCodesDetected(@NonNull final List qrCodes) { + if (isReleased) { + return; + } for (final String qrCodeContent : qrCodes) { try { final PaymentQRCodeData paymentData = mParser.parse(qrCodeContent); @@ -119,6 +123,7 @@ public void readFromByteArray(@NonNull final byte[] image, @NonNull final Size i * Release all resources. Detection not possible after this has been called. */ public void release() { + isReleased = true; mDetector.release(); }