Skip to content

Commit

Permalink
fix(capture-sdk): Fix loading indicator hiding
Browse files Browse the repository at this point in the history
PP-203
  • Loading branch information
jackkray committed Jul 26, 2024
1 parent e3e8f00 commit aba3297
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,9 @@ private void updateNextButtonVisibility() {
break;
}
}
if (!uploadFailed) {
hideIndicator();
}
setNextButtonEnabled(!uploadFailed);
}

Expand Down Expand Up @@ -815,7 +818,6 @@ void uploadDocument(final ImageDocument document) {
}

} else if (requestResult != null) {
hideIndicator();
mDocumentUploadResults.put(document.getId(), true);
}
updateNextButtonVisibility();
Expand Down

0 comments on commit aba3297

Please sign in to comment.