From 8660d4e2186ba1e910e10456cfc6b8b0b91ae919 Mon Sep 17 00:00:00 2001 From: Branden Archer Date: Sun, 12 Feb 2017 22:37:11 -0500 Subject: [PATCH 1/2] Pre-populate card id in Barcode Selector If a user is attempting to update a card id of an existing card, before when the Enter Card button was selected the barcode selector view would be empty. To be more useful, the view will now be pre-populated with the existing card id. --- .../protect/card_locker/BarcodeSelectorActivity.java | 8 ++++++++ .../protect/card_locker/LoyaltyCardViewActivity.java | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/app/src/main/java/protect/card_locker/BarcodeSelectorActivity.java b/app/src/main/java/protect/card_locker/BarcodeSelectorActivity.java index 10dcb8e24..3688cabd7 100644 --- a/app/src/main/java/protect/card_locker/BarcodeSelectorActivity.java +++ b/app/src/main/java/protect/card_locker/BarcodeSelectorActivity.java @@ -124,6 +124,14 @@ public class BarcodeSelectorActivity extends AppCompatActivity // Noting to do } }); + + final Bundle b = getIntent().getExtras(); + final String initialCardId = b != null ? b.getString("initialCardId") : null; + + if(initialCardId != null) + { + cardId.setText(initialCardId); + } } private void createBarcodeOption(final ImageView image, final String formatType, final String cardId) diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java index c4b759ce2..054fd2af0 100644 --- a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java +++ b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java @@ -222,6 +222,15 @@ public class LoyaltyCardViewActivity extends AppCompatActivity public void onClick(View v) { Intent i = new Intent(getApplicationContext(), BarcodeSelectorActivity.class); + + String cardId = cardIdFieldEdit.getText().toString(); + if(cardId.length() > 0) + { + final Bundle b = new Bundle(); + b.putString("initialCardId", cardId); + i.putExtras(b); + } + startActivityForResult(i, SELECT_BARCODE_REQUEST); } }); From 2768f4c590da5099ac6bb15aec57b4458ae6a63f Mon Sep 17 00:00:00 2001 From: Branden Archer Date: Sun, 12 Feb 2017 22:40:15 -0500 Subject: [PATCH 2/2] Start with all barcode images visible If the user enters the barcode selector view with a pre-existing id, the barcodes are immediately drawn. However, if the ImageViews were invisible their initial size is not known, and as such the generated barcode images are fuzzy or not as expected. To avoid this, all images are set to be visible. The expectation is that once the barcodes are drawn for the first time if they are invalid the images will be made invisible anyway. --- .../main/java/protect/card_locker/BarcodeSelectorActivity.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/protect/card_locker/BarcodeSelectorActivity.java b/app/src/main/java/protect/card_locker/BarcodeSelectorActivity.java index 3688cabd7..5cf0f9250 100644 --- a/app/src/main/java/protect/card_locker/BarcodeSelectorActivity.java +++ b/app/src/main/java/protect/card_locker/BarcodeSelectorActivity.java @@ -144,7 +144,6 @@ public class BarcodeSelectorActivity extends AppCompatActivity } image.setImageBitmap(null); - image.setVisibility(View.GONE); image.setOnClickListener(new View.OnClickListener() { @Override