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 dd2ada2294..d3e779b177 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 @@ -177,6 +177,7 @@ public void onExtractionsAvailable( private static final String IN_MULTI_PAGE_STATE_KEY = "IN_MULTI_PAGE_STATE_KEY"; private static final String IS_FLASH_ENABLED_KEY = "IS_FLASH_ENABLED_KEY"; + private static final String IS_NOT_AVAILABLE_DETECTION_POPUP_SHOWED_KEY = "IS_ARGS_NOT_AVAILABLE_DETECTION_POPUP_SHOWED_KEY"; private final FragmentImplCallback mFragment; private final CancelListener mCancelListener; @@ -221,9 +222,11 @@ public void onExtractionsAvailable( private ImageView mImageFrame; private ViewStubSafeInflater mViewStubInflater; private ConstraintLayout mPaneWrapper; + private ConstraintLayout mDetectionErrorLayout; private TextView mScanTextView; private TextView mIbanDetectedTextView; private boolean mIsTakingPicture; + private boolean mIsDetectionErrorPopupShowed; private boolean mImportDocumentButtonEnabled; private ImportImageFileUrisAsyncTask mImportUrisAsyncTask; @@ -239,6 +242,7 @@ public void onExtractionsAvailable( private IBANRecognizerFilter ibanRecognizerFilter; private CropToCameraFrameTextRecognizer cropToCameraFrameTextRecognizer; private final UserAnalyticsScreen screenName = UserAnalyticsScreen.Camera.INSTANCE; + private View mDetectionErrorDismissButton; CameraFragmentImpl(@NonNull final FragmentImplCallback fragment, @NonNull final CancelListener cancelListener, final boolean addPages) { mFragment = fragment; @@ -265,6 +269,10 @@ public void onQRCodeReaderFail() { "QRCode detector dependencies are not yet available. QRCode detection is disabled."); setQRDisabledTexts(); + if (!mIsDetectionErrorPopupShowed) { + mIsDetectionErrorPopupShowed = true; + mDetectionErrorLayout.setVisibility(View.VISIBLE); + } } private void handleQRCodeDetected(@Nullable final PaymentQRCodeData paymentQRCodeData, @@ -355,6 +363,7 @@ private void initFlashState() { private void restoreSavedState(@NonNull final Bundle savedInstanceState) { mInMultiPageState = savedInstanceState.getBoolean(IN_MULTI_PAGE_STATE_KEY); mIsFlashEnabled = savedInstanceState.getBoolean(IS_FLASH_ENABLED_KEY); + mIsDetectionErrorPopupShowed = savedInstanceState.getBoolean(IS_NOT_AVAILABLE_DETECTION_POPUP_SHOWED_KEY); } View onCreateView(final LayoutInflater inflater, final ViewGroup container, @@ -672,6 +681,7 @@ private CompletableFuture openCamera() { void onSaveInstanceState(@NonNull final Bundle outState) { outState.putBoolean(IN_MULTI_PAGE_STATE_KEY, mInMultiPageState); outState.putBoolean(IS_FLASH_ENABLED_KEY, mIsFlashEnabled); + outState.putBoolean(IS_NOT_AVAILABLE_DETECTION_POPUP_SHOWED_KEY, mIsDetectionErrorPopupShowed); } void onStop() { @@ -733,6 +743,8 @@ private void bindViews(final View view) { mPaneWrapper = view.findViewById(R.id.gc_pane_wrapper); mLoadingIndicator = view.findViewById(R.id.gc_injected_loading_indicator); mIbanDetectedTextView = view.findViewById(R.id.gc_iban_detected); + mDetectionErrorLayout = view.findViewById(R.id.gc_detection_error_layout); + mDetectionErrorDismissButton = mDetectionErrorLayout.findViewById(R.id.gc_detection_error_popup_dismiss_button); if (!ContextHelper.isTablet(mFragment.getActivity())) { mScanTextView = view.findViewById(R.id.gc_camera_title); @@ -947,6 +959,10 @@ private void setInputHandlers() { ); onBackPressed(); }); + + ClickListenerExtKt.setIntervalClickListener(mDetectionErrorDismissButton, v -> { + mDetectionErrorLayout.setVisibility(View.GONE); + }); } @VisibleForTesting diff --git a/capture-sdk/sdk/src/main/res/drawable-sw600dp/gc_camera_frame.xml b/capture-sdk/sdk/src/main/res/drawable-sw600dp/gc_camera_frame.xml index ed583b6881..ff4b356107 100644 --- a/capture-sdk/sdk/src/main/res/drawable-sw600dp/gc_camera_frame.xml +++ b/capture-sdk/sdk/src/main/res/drawable-sw600dp/gc_camera_frame.xml @@ -9,7 +9,7 @@ android:fillColor="#00000000" android:strokeColor="#ffffff"/> @@ -19,7 +19,7 @@ android:fillColor="#00000000" android:strokeColor="#ffffff"/> diff --git a/capture-sdk/sdk/src/main/res/drawable/gc_camera_frame.xml b/capture-sdk/sdk/src/main/res/drawable/gc_camera_frame.xml index ce9e139956..4e08e8b0e7 100644 --- a/capture-sdk/sdk/src/main/res/drawable/gc_camera_frame.xml +++ b/capture-sdk/sdk/src/main/res/drawable/gc_camera_frame.xml @@ -9,7 +9,7 @@ android:fillColor="#00000000" android:strokeColor="#ffffff"/> @@ -19,7 +19,7 @@ android:fillColor="#00000000" android:strokeColor="#ffffff"/> diff --git a/capture-sdk/sdk/src/main/res/drawable/gc_detection_error_background.xml b/capture-sdk/sdk/src/main/res/drawable/gc_detection_error_background.xml new file mode 100644 index 0000000000..5bf16f3c71 --- /dev/null +++ b/capture-sdk/sdk/src/main/res/drawable/gc_detection_error_background.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/capture-sdk/sdk/src/main/res/layout-sw600dp-land/gc_fragment_camera.xml b/capture-sdk/sdk/src/main/res/layout-sw600dp-land/gc_fragment_camera.xml index ec997a8aa1..2080d60c03 100644 --- a/capture-sdk/sdk/src/main/res/layout-sw600dp-land/gc_fragment_camera.xml +++ b/capture-sdk/sdk/src/main/res/layout-sw600dp-land/gc_fragment_camera.xml @@ -357,6 +357,20 @@ app:layout_constraintStart_toStartOf="@+id/gc_injected_loading_indicator" app:layout_constraintTop_toBottomOf="@+id/gc_injected_loading_indicator" /> + + - + + + + + + + diff --git a/capture-sdk/sdk/src/main/res/layout/gc_fragment_camera.xml b/capture-sdk/sdk/src/main/res/layout/gc_fragment_camera.xml index 5c7824bb94..06492d7751 100644 --- a/capture-sdk/sdk/src/main/res/layout/gc_fragment_camera.xml +++ b/capture-sdk/sdk/src/main/res/layout/gc_fragment_camera.xml @@ -371,8 +371,22 @@ app:layout_constraintStart_toStartOf="@+id/gc_injected_loading_indicator" app:layout_constraintTop_toBottomOf="@+id/gc_injected_loading_indicator" /> - + + + Select Cancel + QR code scanning is currently unavailable. Please take a picture of your invoice instead. \ No newline at end of file diff --git a/capture-sdk/sdk/src/main/res/values-sw600dp/dimens.xml b/capture-sdk/sdk/src/main/res/values-sw600dp/dimens.xml index 8503147102..6185783d7e 100644 --- a/capture-sdk/sdk/src/main/res/values-sw600dp/dimens.xml +++ b/capture-sdk/sdk/src/main/res/values-sw600dp/dimens.xml @@ -12,6 +12,7 @@ 80dp 96dp 96dp + 16dp 336dp 152dp diff --git a/capture-sdk/sdk/src/main/res/values/dimens.xml b/capture-sdk/sdk/src/main/res/values/dimens.xml index 115372ddcf..b0f5dafcdd 100644 --- a/capture-sdk/sdk/src/main/res/values/dimens.xml +++ b/capture-sdk/sdk/src/main/res/values/dimens.xml @@ -11,6 +11,7 @@ 64dp 80dp 96dp + 8dp 80dp @@ -30,6 +31,7 @@ 80dp 48dp 250dp + 350dp 76dp 50dp diff --git a/capture-sdk/sdk/src/main/res/values/strings.xml b/capture-sdk/sdk/src/main/res/values/strings.xml index 54a4d1fab6..b8bfded8e7 100644 --- a/capture-sdk/sdk/src/main/res/values/strings.xml +++ b/capture-sdk/sdk/src/main/res/values/strings.xml @@ -177,4 +177,5 @@ Auswählen Abbrechen + QR-Code scannen ist derzeit nicht verfügbar. Bitte fotografieren Sie stattdessen Ihre Rechnung.