diff --git a/app/src/main/java/protect/card_locker/BarcodeImageWriterTask.java b/app/src/main/java/protect/card_locker/BarcodeImageWriterTask.java index f3f66c926..43d9405ae 100644 --- a/app/src/main/java/protect/card_locker/BarcodeImageWriterTask.java +++ b/app/src/main/java/protect/card_locker/BarcodeImageWriterTask.java @@ -61,7 +61,12 @@ public class BarcodeImageWriterTask implements CompatCallable { 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); diff --git a/app/src/main/java/protect/card_locker/CatimaBarcode.java b/app/src/main/java/protect/card_locker/CatimaBarcode.java index 2b1a5c488..d19743a0b 100644 --- a/app/src/main/java/protect/card_locker/CatimaBarcode.java +++ b/app/src/main/java/protect/card_locker/CatimaBarcode.java @@ -72,6 +72,11 @@ public class CatimaBarcode { || mBarcodeFormat == BarcodeFormat.QR_CODE; } + public boolean hasInternalPadding() { + return mBarcodeFormat == BarcodeFormat.PDF_417 + || mBarcodeFormat == BarcodeFormat.QR_CODE; + } + public BarcodeFormat format() { return mBarcodeFormat; }