From 31b9123a8fd5921c93ca2d81202d0eb3a32030e8 Mon Sep 17 00:00:00 2001 From: Sylvia van Os Date: Tue, 19 Sep 2023 19:39:33 +0200 Subject: [PATCH 1/3] Don't close view activity when entering edit activity --- .../main/java/protect/card_locker/LoyaltyCardViewActivity.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java index dad65ca3e..b527e137a 100644 --- a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java +++ b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java @@ -293,7 +293,6 @@ public class LoyaltyCardViewActivity extends CatimaAppCompatActivity implements bundle.putBoolean(LoyaltyCardEditActivity.BUNDLE_UPDATE, true); intent.putExtras(bundle); startActivity(intent); - finish(); }); binding.fabEdit.bringToFront(); From 8310f096412d22ad0f8ced67d877b7061b8e43d6 Mon Sep 17 00:00:00 2001 From: Sylvia van Os Date: Tue, 19 Sep 2023 19:40:13 +0200 Subject: [PATCH 2/3] Hide keyboard when switching back to view view --- .../protect/card_locker/LoyaltyCardViewActivity.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java index b527e137a..f4fda0564 100644 --- a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java +++ b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java @@ -550,13 +550,18 @@ public class LoyaltyCardViewActivity extends CatimaAppCompatActivity implements Log.i(TAG, "To view card: " + loyaltyCardId); - // The brightness value is on a scale from [0, ..., 1], where - // '1' is the brightest. We attempt to maximize the brightness - // to help barcode readers scan the barcode. Window window = getWindow(); if (window != null) { + // Hide the keyboard if still shown (could be the case when returning from edit activity + window.setSoftInputMode( + WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN + ); + WindowManager.LayoutParams attributes = window.getAttributes(); + // The brightness value is on a scale from [0, ..., 1], where + // '1' is the brightest. We attempt to maximize the brightness + // to help barcode readers scan the barcode. if (settings.useMaxBrightnessDisplayingBarcode()) { attributes.screenBrightness = 1F; } From 473f8e6b721c7c6d1b2a3de0fb6bc559e4968a8a Mon Sep 17 00:00:00 2001 From: Sylvia van Os Date: Tue, 19 Sep 2023 20:45:34 +0200 Subject: [PATCH 3/3] Fix barcode not showing when returning and changing from none to some barcode --- .../java/protect/card_locker/LoyaltyCardViewActivity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java index f4fda0564..f0cae1f5e 100644 --- a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java +++ b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java @@ -98,7 +98,6 @@ public class LoyaltyCardViewActivity extends CatimaAppCompatActivity implements ImageView barcodeRenderTarget; int mainImageIndex = 0; List imageTypes; - boolean isBarcodeSupported = true; static final String STATE_IMAGEINDEX = "imageIndex"; static final String STATE_FULLSCREEN = "isFullscreen"; @@ -643,12 +642,15 @@ public class LoyaltyCardViewActivity extends CatimaAppCompatActivity implements fixBottomAppBarImageButtonColor(binding.bottomAppBarUpdateBalanceButton); setBottomAppBarButtonState(); + boolean isBarcodeSupported; if (format != null && !format.isSupported()) { isBarcodeSupported = false; Toast.makeText(this, getString(R.string.unsupportedBarcodeType), Toast.LENGTH_LONG).show(); } else if (format == null) { isBarcodeSupported = false; + } else { + isBarcodeSupported = true; } imageTypes = new ArrayList<>();