diff --git a/CHANGELOG.md b/CHANGELOG.md index 943064cff..33ab06452 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Changes: - Add missing barcode ID to export +- Don't show update barcode dialog if value is the same as card ID ## v1.14 (2021-06-07) diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java b/app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java index 64b89d2e9..4cb82e120 100644 --- a/app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java +++ b/app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java @@ -707,6 +707,18 @@ public class LoyaltyCardEditActivity extends AppCompatActivity } private void askBarcodeChange(Runnable callback) { + if (tempStoredOldBarcodeValue.equals(cardIdFieldView.getText().toString())) { + // They are the same, don't ask + barcodeIdField.setText(R.string.sameAsCardId); + tempStoredOldBarcodeValue = null; + + if (callback != null) { + callback.run(); + } + + return; + } + new AlertDialog.Builder(this) .setTitle(R.string.updateBarcodeQuestionTitle) .setMessage(R.string.updateBarcodeQuestionText) @@ -726,6 +738,14 @@ public class LoyaltyCardEditActivity extends AppCompatActivity callback.run(); } }) + .setOnDismissListener(dialogInterface -> { + barcodeIdField.setText(tempStoredOldBarcodeValue); + tempStoredOldBarcodeValue = null; + + if (callback != null) { + callback.run(); + } + }) .show(); }