From 82db76f3a91d1eeb0a5415d858201543f9e0918c Mon Sep 17 00:00:00 2001 From: Sylvia van Os Date: Tue, 30 May 2023 12:31:21 +0200 Subject: [PATCH] Fix long barcode values causing barcode to scale down to nothing --- CHANGELOG.md | 1 + .../protect/card_locker/LoyaltyCardViewActivity.java | 10 ++++++++++ app/src/main/res/layout/loyalty_card_view_layout.xml | 2 ++ 3 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cfa7ced9..234b0bf3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Long-press card icon in view activity to change it - Improve button styling in Groups screen +- Fix long barcode values causing barcode to scale down to nothing ## v2.23.1 - 121 diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java index 80d2c81b4..5fb532387 100644 --- a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java +++ b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java @@ -605,6 +605,16 @@ public class LoyaltyCardViewActivity extends CatimaAppCompatActivity implements binding.cardIdView.setText(loyaltyCard.cardId); + // Display full text on click in case it doesn't fit in a single line + binding.cardIdView.setOnClickListener(v -> { + AlertDialog.Builder builder = new MaterialAlertDialogBuilder(LoyaltyCardViewActivity.this); + builder.setTitle(R.string.barcodeId); + builder.setMessage(loyaltyCard.cardId); + builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> dialogInterface.dismiss()); + AlertDialog dialog = builder.create(); + dialog.show(); + }); + int backgroundHeaderColor; if (loyaltyCard.headerColor != null) { backgroundHeaderColor = loyaltyCard.headerColor; diff --git a/app/src/main/res/layout/loyalty_card_view_layout.xml b/app/src/main/res/layout/loyalty_card_view_layout.xml index 589dc0323..a14b7549b 100644 --- a/app/src/main/res/layout/loyalty_card_view_layout.xml +++ b/app/src/main/res/layout/loyalty_card_view_layout.xml @@ -125,6 +125,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="@dimen/text_size_large" + android:ellipsize="end" + android:singleLine="true" android:gravity="center"/>