From 8310f096412d22ad0f8ced67d877b7061b8e43d6 Mon Sep 17 00:00:00 2001 From: Sylvia van Os Date: Tue, 19 Sep 2023 19:40:13 +0200 Subject: [PATCH] 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; }