Add note on unsupported barcode type

This commit is contained in:
Sylvia van Os
2021-04-03 15:11:22 +02:00
parent ac551ed93f
commit 9889678e53
3 changed files with 17 additions and 2 deletions

View File

@@ -388,7 +388,13 @@ public class LoyaltyCardEditActivity extends AppCompatActivity
barcodeTypeField.setTag(null);
} else {
try {
barcodeTypeField.setTag(BarcodeFormat.valueOf(s.toString()));
BarcodeFormat barcodeFormat = BarcodeFormat.valueOf(s.toString());
barcodeTypeField.setTag(barcodeFormat);
if (!BarcodeSelectorActivity.SUPPORTED_BARCODE_TYPES.contains(barcodeFormat.name())) {
Toast.makeText(LoyaltyCardEditActivity.this, getString(R.string.unsupportedBarcodeType), Toast.LENGTH_LONG).show();
}
} catch (IllegalArgumentException e) {}
}

View File

@@ -387,7 +387,15 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
// Set shadow colour of store text so even same color on same color would be readable
storeName.setShadowLayer(1, 1, 1, backgroundNeedsDarkIcons ? Color.BLACK : Color.WHITE);
if(format != null)
Boolean isBarcodeSupported = true;
if (format != null && !BarcodeSelectorActivity.SUPPORTED_BARCODE_TYPES.contains(format.name())) {
isBarcodeSupported = false;
Toast.makeText(this, getString(R.string.unsupportedBarcodeType), Toast.LENGTH_LONG).show();
}
if(format != null && isBarcodeSupported)
{
if (!barcodeIsFullscreen) {
maximizeButton.setVisibility(View.VISIBLE);

View File

@@ -171,4 +171,5 @@
<string name="barcodeId">Barcode value</string>
<string name="sameAsCardId">Same as card ID</string>
<string name="setBarcodeId">Set barcode value</string>
<string name="unsupportedBarcodeType">We cannot currently display this barcode type. We hope to add support in a newer version of the app.</string>
</resources>