mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-02-05 20:52:41 -05:00
Don't show update barcode dialog if value is the same as card ID
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user