mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-14 06:22:50 +01:00
Possible fix to loading videos on home page
This commit is contained in:
parent
d25137020f
commit
feeeefa2d2
@ -913,15 +913,15 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
|||||||
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
||||||
int width = resource.getIntrinsicWidth();
|
int width = resource.getIntrinsicWidth();
|
||||||
int height = resource.getIntrinsicHeight();
|
int height = resource.getIntrinsicHeight();
|
||||||
((PostVideoAutoplayViewHolder) holder).previewImageView.setImageDrawable(resource);
|
((PostCard2VideoAutoplayViewHolder) holder).previewImageView.setImageDrawable(resource);
|
||||||
if (preview.getPreviewHeight() <= 0 || preview.getPreviewWidth() <= 0) {
|
if (preview.getPreviewHeight() <= 0 || preview.getPreviewWidth() <= 0) {
|
||||||
((PostVideoAutoplayViewHolder) holder).aspectRatioFrameLayout.setAspectRatio((float) height / width);
|
((PostCard2VideoAutoplayViewHolder) holder).aspectRatioFrameLayout.setAspectRatio((float) height / width);
|
||||||
((PostVideoAutoplayViewHolder) holder).previewImageView.getLayoutParams().height = height;
|
((PostCard2VideoAutoplayViewHolder) holder).previewImageView.getLayoutParams().height = height;
|
||||||
preview.setPreviewHeight(height);
|
preview.setPreviewHeight(height);
|
||||||
preview.setPreviewWidth(width);
|
preview.setPreviewWidth(width);
|
||||||
} else {
|
} else {
|
||||||
((PostVideoAutoplayViewHolder) holder).aspectRatioFrameLayout.setAspectRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth());
|
((PostCard2VideoAutoplayViewHolder) holder).aspectRatioFrameLayout.setAspectRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth());
|
||||||
((PostVideoAutoplayViewHolder) holder).previewImageView.getLayoutParams().height = height;
|
((PostCard2VideoAutoplayViewHolder) holder).previewImageView.getLayoutParams().height = height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user