Skip to content

Commit

Permalink
Merge pull request #1740 from CatimaLoyalty/feature/nudge_away_manual…
Browse files Browse the repository at this point in the history
…_entry

Nudge users away from manual entry
  • Loading branch information
TheLastProject authored Feb 18, 2024
2 parents fd396b8 + 41503f9 commit ba87ee7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
22 changes: 15 additions & 7 deletions app/src/main/java/protect/card_locker/ScanActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,21 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
}

public void addManually() {
Intent i = new Intent(getApplicationContext(), BarcodeSelectorActivity.class);
if (cardId != null) {
final Bundle b = new Bundle();
b.putString("initialCardId", cardId);
i.putExtras(b);
}
manualAddLauncher.launch(i);
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(ScanActivity.this);
builder.setTitle(R.string.add_manually_warning_title);
builder.setMessage(R.string.add_manually_warning_message);
builder.setPositiveButton(R.string.continue_, (dialog, which) -> {
Intent i = new Intent(getApplicationContext(), BarcodeSelectorActivity.class);
if (cardId != null) {
final Bundle b = new Bundle();
b.putString("initialCardId", cardId);
i.putExtras(b);
}
manualAddLauncher.launch(i);
});
builder.setNegativeButton(R.string.cancel, (dialog, which) -> setScannerActive(true));
builder.setOnCancelListener(dialog -> setScannerActive(true));
builder.show();
}

public void addFromImage() {
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,7 @@
<string name="add_a_card_in_a_different_way">Add a card in a different way</string>
<string name="field_must_not_be_empty">Field must not be empty</string>
<string name="manually_enter_barcode_instructions">Enter the ID number or text on your card and press the barcode that looks like the one on your card.</string>
<string name="add_manually_warning_title">Scanning is recommended</string>
<string name="add_manually_warning_message">For some stores, the barcode value differs from the number written on the card. Because of this, entering a barcode manually may not always work. It is strongly recommended to scan the barcode with your camera instead. Do you still want to continue?</string>
<string name="continue_">Continue</string>
</resources>

0 comments on commit ba87ee7

Please sign in to comment.