Merge pull request #2254 from perepujal/main

Adding the ability to resize the width in the fullscreen view.
This commit is contained in:
perepujal
2025-04-21 17:06:49 +02:00
committed by GitHub
parent cb547b0a71
commit 4b77700b97
16 changed files with 181 additions and 51 deletions

View File

@@ -49,7 +49,7 @@ public class BarcodeImageWriterTask implements CompatCallable<Bitmap> {
BarcodeImageWriterTask(
Context context, ImageView imageView, String cardIdString,
CatimaBarcode barcodeFormat, TextView textView,
boolean showFallback, BarcodeImageWriterResultCallback callback, boolean roundCornerPadding
boolean showFallback, BarcodeImageWriterResultCallback callback, boolean roundCornerPadding, boolean isFullscreen
) {
mContext = context;
@@ -86,13 +86,13 @@ public class BarcodeImageWriterTask implements CompatCallable<Bitmap> {
if (format.isSquare()) {
imageHeight = imageWidth = Math.min(imageViewHeight, Math.min(MAX_WIDTH, imageViewWidth));
} else if (imageView.getWidth() < MAX_WIDTH) {
} else if (imageView.getWidth() < MAX_WIDTH && !isFullscreen) {
imageHeight = imageViewHeight;
imageWidth = imageViewWidth;
} else {
// Scale down the image to reduce the memory needed to produce it
imageWidth = MAX_WIDTH;
double ratio = (double) MAX_WIDTH / (double) imageViewWidth;
imageWidth = Math.min(MAX_WIDTH, this.mContext.getResources().getDisplayMetrics().widthPixels);
double ratio = (double) imageWidth / (double) imageViewWidth;
imageHeight = (int) (imageViewHeight * ratio);
}