Fix link cards

This commit is contained in:
Grishka 2023-10-29 14:43:10 +03:00
parent bc490218f9
commit 97d19605d5
1 changed files with 9 additions and 2 deletions

View File

@ -75,7 +75,8 @@ public class LinkCardStatusDisplayItem extends StatusDisplayItem{
if(item.imgRequest!=null){
crossfadeDrawable.setSize(card.width, card.height);
crossfadeDrawable.setBlurhashDrawable(card.blurhashPlaceholder);
crossfadeDrawable.setCrossfadeAlpha(item.status.spoilerRevealed ? 0f : 1f);
crossfadeDrawable.setCrossfadeAlpha(0f);
photo.setImageDrawable(null);
photo.setImageDrawable(crossfadeDrawable);
didClear=false;
}
@ -84,8 +85,14 @@ public class LinkCardStatusDisplayItem extends StatusDisplayItem{
@Override
public void setImage(int index, Drawable drawable){
crossfadeDrawable.setImageDrawable(drawable);
if(didClear && item.status.spoilerRevealed)
if(didClear)
crossfadeDrawable.animateAlpha(0f);
Card card=item.status.card;
// Make sure the image is not stretched if the server returned wrong dimensions
if(drawable!=null && (drawable.getIntrinsicWidth()!=card.width || drawable.getIntrinsicHeight()!=card.height)){
photo.setImageDrawable(null);
photo.setImageDrawable(crossfadeDrawable);
}
}
@Override