Fix extreme padding on some barcode types

This commit is contained in:
Sylvia van Os
2022-03-09 19:07:19 +01:00
parent 78d0bc7bb7
commit 1ce4216584
2 changed files with 11 additions and 1 deletions

View File

@@ -61,7 +61,12 @@ public class BarcodeImageWriterTask implements CompatCallable<Bitmap> {
cardId = cardIdString;
format = barcodeFormat;
int padding = roundCornerPadding ? Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, context.getResources().getDisplayMetrics())) : 0;
int padding = 0;
// Some barcodes already have internal whitespace and shouldn't get extra padding
// TODO: Get rid of this hack by somehow detecting this extra whitespace
if (roundCornerPadding && !barcodeFormat.hasInternalPadding()) {
padding = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, context.getResources().getDisplayMetrics()));
}
final int MAX_WIDTH = getMaxWidth(format);