mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-02-01 10:42:01 -05:00
Dynamically size barcode based on their shape (square or rectangle) (#501)
This commit is contained in:
@@ -63,6 +63,13 @@ public class CatimaBarcode {
|
||||
return barcodeFormats.contains(mBarcodeFormat);
|
||||
}
|
||||
|
||||
public boolean isSquare(){
|
||||
return mBarcodeFormat == BarcodeFormat.AZTEC
|
||||
|| mBarcodeFormat == BarcodeFormat.DATA_MATRIX
|
||||
|| mBarcodeFormat == BarcodeFormat.MAXICODE
|
||||
|| mBarcodeFormat == BarcodeFormat.QR_CODE;
|
||||
}
|
||||
|
||||
public BarcodeFormat format() {
|
||||
return mBarcodeFormat;
|
||||
}
|
||||
|
||||
@@ -268,7 +268,10 @@ public class LoyaltyCardViewActivity extends CatimaAppCompatActivity implements
|
||||
if (imageTypes.get(mainImageIndex) == ImageType.BARCODE) {
|
||||
redrawBarcodeAfterResize();
|
||||
}
|
||||
centerGuideline.setGuidelinePercent(0.5f * scale);
|
||||
if(loyaltyCard!=null && format!=null && format.isSquare())
|
||||
centerGuideline.setGuidelinePercent(0.75f * scale);
|
||||
else
|
||||
centerGuideline.setGuidelinePercent(0.5f * scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -417,6 +420,12 @@ public class LoyaltyCardViewActivity extends CatimaAppCompatActivity implements
|
||||
setupOrientation();
|
||||
|
||||
format = loyaltyCard.barcodeType;
|
||||
if(format != null && format.isSquare()){
|
||||
centerGuideline.setGuidelinePercent(0.75f);
|
||||
}
|
||||
else{
|
||||
centerGuideline.setGuidelinePercent(0.5f);
|
||||
}
|
||||
cardIdString = loyaltyCard.cardId;
|
||||
barcodeIdString = loyaltyCard.barcodeId;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user