mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-27 19:38:22 +01:00
Fix loading previews after quick scroll (#861)
* Request layout on ratio change * Change imageView visibility on bind/recycle to force layout change
This commit is contained in:
parent
3c0e2ab2d6
commit
8db3736dd4
@ -812,6 +812,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
Post.Preview preview = getSuitablePreview(post.getPreviews());
|
||||
((PostWithPreviewTypeViewHolder) holder).preview = preview;
|
||||
if (preview != null) {
|
||||
((PostWithPreviewTypeViewHolder) holder).imageView.setVisibility(View.VISIBLE);
|
||||
((PostWithPreviewTypeViewHolder) holder).imageWrapperRelativeLayout.setVisibility(View.VISIBLE);
|
||||
if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) {
|
||||
int height = (int) (400 * mScale);
|
||||
@ -1847,6 +1848,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
((PostVideoAutoplayViewHolder) holder).previewImageView.setVisibility(View.GONE);
|
||||
} else if (holder instanceof PostWithPreviewTypeViewHolder) {
|
||||
mGlide.clear(((PostWithPreviewTypeViewHolder) holder).imageView);
|
||||
((PostWithPreviewTypeViewHolder) holder).imageView.setVisibility(View.GONE);
|
||||
((PostWithPreviewTypeViewHolder) holder).imageWrapperRelativeLayout.setVisibility(View.GONE);
|
||||
((PostWithPreviewTypeViewHolder) holder).errorTextView.setVisibility(View.GONE);
|
||||
((PostWithPreviewTypeViewHolder) holder).noPreviewLinkImageView.setVisibility(View.GONE);
|
||||
|
@ -25,7 +25,12 @@ public class AspectRatioGifImageView extends GifImageView {
|
||||
}
|
||||
|
||||
public final void setRatio(float var1) {
|
||||
this.ratio = var1;
|
||||
if (this.ratio != var1) {
|
||||
this.ratio = var1;
|
||||
|
||||
requestLayout();
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void init(Context context, AttributeSet attrs) {
|
||||
|
Loading…
Reference in New Issue
Block a user