From 3ea8b370bb256937fc0e415cdf25fc6f29eed7a4 Mon Sep 17 00:00:00 2001 From: LucasGGamerM Date: Sun, 3 Mar 2024 16:25:09 -0300 Subject: [PATCH] fix(link-card): use placeholder image when there is no card image And round off the corners too --- .../ui/displayitems/LinkCardStatusDisplayItem.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/LinkCardStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/LinkCardStatusDisplayItem.java index dcd2fb361a..c06ce66b65 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/LinkCardStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/LinkCardStatusDisplayItem.java @@ -115,17 +115,11 @@ public void onBind(LinkCardStatusDisplayItem item){ photo.setVisibility(View.VISIBLE); didClear=false; } else { - photo.setVisibility(View.GONE); + photo.setBackgroundColor(UiUtils.getThemeColor(itemView.getContext(), R.attr.colorM3SurfaceVariant)); + photo.setImageTintList(ColorStateList.valueOf(UiUtils.getThemeColor(itemView.getContext(), R.attr.colorM3Outline))); + photo.setScaleType(ImageView.ScaleType.CENTER); + photo.setImageResource(R.drawable.ic_feed_48px); } - - // if there's no image, we don't want to cover the inset borders - FrameLayout.LayoutParams params=(FrameLayout.LayoutParams) inner.getLayoutParams(); - int margin=item.inset && item.imgRequest == null ? V.dp(1) : 0; - params.setMargins(margin, 0, margin, margin); - - boolean insetAndLast=item.inset && isLastDisplayItemForStatus(); - inner.setClipToOutline(insetAndLast); - inner.setOutlineProvider(insetAndLast ? OutlineProviders.bottomRoundedRect(12) : null); } @Override