Skip to content

Commit

Permalink
fix(link-card): use placeholder image when there is no card image
Browse files Browse the repository at this point in the history
And round off the corners too
  • Loading branch information
LucasGGamerM committed Mar 3, 2024
1 parent 02eb178 commit 3ea8b37
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3ea8b37

Please sign in to comment.