From aba32972ad0467cdfd6afd932150017b11614c33 Mon Sep 17 00:00:00 2001 From: jackkray Date: Fri, 26 Jul 2024 14:06:26 +0200 Subject: [PATCH] fix(capture-sdk): Fix loading indicator hiding PP-203 --- .../capture/internal/camera/photo/ImmutablePhoto.java | 7 ++++++- .../capture/review/multipage/MultiPageReviewFragment.java | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/camera/photo/ImmutablePhoto.java b/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/camera/photo/ImmutablePhoto.java index e0d9d3f817..136ff2a9ce 100644 --- a/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/camera/photo/ImmutablePhoto.java +++ b/capture-sdk/sdk/src/main/java/net/gini/android/capture/internal/camera/photo/ImmutablePhoto.java @@ -29,6 +29,7 @@ class ImmutablePhoto implements Photo { private static final Logger LOG = LoggerFactory.getLogger(ImmutablePhoto.class); + private static final int PREVIEW_SHRINK_WEIGHT = 5_000; Bitmap mBitmapPreview; byte[] mData; @@ -61,7 +62,11 @@ final Bitmap createPreview() { } final BitmapFactory.Options options = new BitmapFactory.Options(); - options.inSampleSize = 2; + if (mData.length / 1_000 > PREVIEW_SHRINK_WEIGHT) { + options.inSampleSize = 8; + } else { + options.inSampleSize = 2; + } return BitmapFactory.decodeByteArray(mData, 0, mData.length, options); } diff --git a/capture-sdk/sdk/src/main/java/net/gini/android/capture/review/multipage/MultiPageReviewFragment.java b/capture-sdk/sdk/src/main/java/net/gini/android/capture/review/multipage/MultiPageReviewFragment.java index 588a946e97..6d81ec007c 100644 --- a/capture-sdk/sdk/src/main/java/net/gini/android/capture/review/multipage/MultiPageReviewFragment.java +++ b/capture-sdk/sdk/src/main/java/net/gini/android/capture/review/multipage/MultiPageReviewFragment.java @@ -684,6 +684,9 @@ private void updateNextButtonVisibility() { break; } } + if (!uploadFailed) { + hideIndicator(); + } setNextButtonEnabled(!uploadFailed); } @@ -815,7 +818,6 @@ void uploadDocument(final ImageDocument document) { } } else if (requestResult != null) { - hideIndicator(); mDocumentUploadResults.put(document.getId(), true); } updateNextButtonVisibility();