From 62f7241bca1ec71cae6276946ab9acf819df6014 Mon Sep 17 00:00:00 2001 From: Sylvia van Os Date: Wed, 11 Dec 2019 10:44:31 +0100 Subject: [PATCH] Check for empty cardId in BarcodeSelectorActivity instead --- .../java/protect/card_locker/BarcodeImageWriterTask.java | 5 ----- .../java/protect/card_locker/BarcodeSelectorActivity.java | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/protect/card_locker/BarcodeImageWriterTask.java b/app/src/main/java/protect/card_locker/BarcodeImageWriterTask.java index 9ef6b7115..a03a52994 100644 --- a/app/src/main/java/protect/card_locker/BarcodeImageWriterTask.java +++ b/app/src/main/java/protect/card_locker/BarcodeImageWriterTask.java @@ -90,11 +90,6 @@ class BarcodeImageWriterTask extends AsyncTask public Bitmap doInBackground(Void... params) { - if (cardId.isEmpty()) - { - return null; - } - MultiFormatWriter writer = new MultiFormatWriter(); BitMatrix bitMatrix; try diff --git a/app/src/main/java/protect/card_locker/BarcodeSelectorActivity.java b/app/src/main/java/protect/card_locker/BarcodeSelectorActivity.java index 86c647c3b..43193647a 100644 --- a/app/src/main/java/protect/card_locker/BarcodeSelectorActivity.java +++ b/app/src/main/java/protect/card_locker/BarcodeSelectorActivity.java @@ -177,6 +177,12 @@ public class BarcodeSelectorActivity extends AppCompatActivity } }); + if (cardId.isEmpty()) + { + image.setVisibility(View.GONE); + return; + } + if(image.getHeight() == 0) { // The size of the ImageView is not yet available as it has not