fix image from another status showing up instead of blurhash (#1699)
This commit is contained in:
parent
9a173f0234
commit
b8ef287b47
|
@ -389,18 +389,21 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||||
return ImageLoadingHelper.decodeBlurHash(this.avatar.getContext(), blurhash);
|
return ImageLoadingHelper.decodeBlurHash(this.avatar.getContext(), blurhash);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadImage(MediaPreviewImageView imageView, String previewUrl, MetaData meta,
|
private void loadImage(MediaPreviewImageView imageView,
|
||||||
|
@Nullable String previewUrl,
|
||||||
|
@Nullable MetaData meta,
|
||||||
@Nullable String blurhash) {
|
@Nullable String blurhash) {
|
||||||
|
|
||||||
Drawable placeholder = blurhash != null ? decodeBlurHash(blurhash) : mediaPreviewUnloaded;
|
Drawable placeholder = blurhash != null ? decodeBlurHash(blurhash) : mediaPreviewUnloaded;
|
||||||
|
|
||||||
if (TextUtils.isEmpty(previewUrl)) {
|
if (TextUtils.isEmpty(previewUrl)) {
|
||||||
if (blurhash != null) {
|
imageView.removeFocalPoint();
|
||||||
imageView.setImageDrawable(decodeBlurHash(blurhash));
|
|
||||||
} else {
|
Glide.with(imageView)
|
||||||
Glide.with(imageView)
|
.load(placeholder)
|
||||||
.load(placeholder)
|
.centerInside()
|
||||||
.centerInside()
|
.into(imageView);
|
||||||
.into(imageView);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Focus focus = meta != null ? meta.getFocus() : null;
|
Focus focus = meta != null ? meta.getFocus() : null;
|
||||||
|
|
||||||
|
@ -459,18 +462,12 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||||
imageView.setContentDescription(description);
|
imageView.setContentDescription(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showingContent) {
|
loadImage(
|
||||||
loadImage(imageView, previewUrl, attachment.getMeta(), attachment.getBlurhash());
|
imageView,
|
||||||
} else {
|
showingContent ? previewUrl : null,
|
||||||
imageView.setFocalPoint(null);
|
attachment.getMeta(),
|
||||||
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
useBlurhash ? attachment.getBlurhash() : null
|
||||||
if (useBlurhash && attachment.getBlurhash() != null) {
|
);
|
||||||
BitmapDrawable blurhashBitmap = decodeBlurHash(attachment.getBlurhash());
|
|
||||||
imageView.setImageDrawable(blurhashBitmap);
|
|
||||||
} else {
|
|
||||||
imageView.setImageDrawable(mediaPreviewUnloaded);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final Attachment.Type type = attachment.getType();
|
final Attachment.Type type = attachment.getType();
|
||||||
if (showingContent && (type == Attachment.Type.VIDEO || type == Attachment.Type.GIFV)) {
|
if (showingContent && (type == Attachment.Type.VIDEO || type == Attachment.Type.GIFV)) {
|
||||||
|
|
Loading…
Reference in New Issue