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 dd2ada229..d3e779b17 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/gc_detection_error_background.xml b/capture-sdk/sdk/src/main/res/drawable/gc_detection_error_background.xml new file mode 100644 index 000000000..5bf16f3c7 --- /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 ec997a8aa..a330e4b0b 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 @@ -359,6 +359,19 @@ + + + + + + + + + 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 5c7824bb9..672807902 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 @@ -373,6 +373,19 @@ + + 80dp 48dp 250dp + 350dp 76dp 50dp