diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java index 170851949..51efb6678 100644 --- a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java +++ b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java @@ -52,6 +52,7 @@ import androidx.core.view.ViewCompat; import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; import androidx.core.widget.TextViewCompat; +import com.google.android.material.color.MaterialColors; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.textfield.TextInputEditText; @@ -873,18 +874,17 @@ public class LoyaltyCardViewActivity extends CatimaAppCompatActivity implements private void drawMainImage(int index, boolean waitForResize, boolean isFullscreen) { if (imageTypes.isEmpty()) { barcodeRenderTarget.setVisibility(View.GONE); + binding.mainCardView.setCardBackgroundColor(Color.TRANSPARENT); + binding.cardIdView.setTextColor(MaterialColors.getColor(binding.cardIdView, com.google.android.material.R.attr.colorOnSurfaceVariant)); return; } ImageType wantedImageType = imageTypes.get(index); if (wantedImageType == ImageType.BARCODE) { - // Use border in non-fullscreen mode - if (!isFullscreen) { - barcodeRenderTarget.setBackground(AppCompatResources.getDrawable(this, R.drawable.round_outline)); - } else { - barcodeRenderTarget.setBackgroundColor(Color.WHITE); - } + barcodeRenderTarget.setBackgroundColor(Color.WHITE); + binding.mainCardView.setCardBackgroundColor(Color.WHITE); + binding.cardIdView.setTextColor(getResources().getColor(R.color.md_theme_light_onSurfaceVariant)); if (waitForResize) { redrawBarcodeAfterResize(!isFullscreen); @@ -896,10 +896,14 @@ public class LoyaltyCardViewActivity extends CatimaAppCompatActivity implements } else if (wantedImageType == ImageType.IMAGE_FRONT) { barcodeRenderTarget.setImageBitmap(frontImageBitmap); barcodeRenderTarget.setBackgroundColor(Color.TRANSPARENT); + binding.mainCardView.setCardBackgroundColor(Color.TRANSPARENT); + binding.cardIdView.setTextColor(MaterialColors.getColor(binding.cardIdView, com.google.android.material.R.attr.colorOnSurfaceVariant)); barcodeRenderTarget.setContentDescription(getString(R.string.frontImageDescription)); } else if (wantedImageType == ImageType.IMAGE_BACK) { barcodeRenderTarget.setImageBitmap(backImageBitmap); barcodeRenderTarget.setBackgroundColor(Color.TRANSPARENT); + binding.mainCardView.setCardBackgroundColor(Color.TRANSPARENT); + binding.cardIdView.setTextColor(MaterialColors.getColor(binding.cardIdView, com.google.android.material.R.attr.colorOnSurfaceVariant)); barcodeRenderTarget.setContentDescription(getString(R.string.backImageDescription)); } else { throw new IllegalArgumentException("Unknown image type: " + wantedImageType); 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 54d1ccf07..887ab75d6 100644 --- a/app/src/main/res/layout/loyalty_card_view_layout.xml +++ b/app/src/main/res/layout/loyalty_card_view_layout.xml @@ -101,6 +101,7 @@ android:layout_weight="1">