mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-30 12:57:12 +01:00
Fix image preview not available. Fix gif autoplay.
This commit is contained in:
parent
50f5612a14
commit
0201a661b2
@ -612,7 +612,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
||||
((PostWithPreviewTypeViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
|
||||
((PostWithPreviewTypeViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.video));
|
||||
} else if (post.getPostType() == Post.GIF_TYPE) {
|
||||
((PostWithPreviewTypeViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
|
||||
if (!mAutoplay) {
|
||||
((PostWithPreviewTypeViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
((PostWithPreviewTypeViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.gif));
|
||||
} else if (post.getPostType() == Post.IMAGE_TYPE) {
|
||||
((PostWithPreviewTypeViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.image));
|
||||
@ -964,7 +966,13 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
||||
private void loadImage(final RecyclerView.ViewHolder holder, final Post post, @NonNull Post.Preview preview) {
|
||||
if (preview != null) {
|
||||
if (holder instanceof PostWithPreviewTypeViewHolder) {
|
||||
RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(preview.getPreviewUrl()).listener(new RequestListener<Drawable>() {
|
||||
String url;
|
||||
if (post.getPostType() == Post.GIF_TYPE && mAutoplay) {
|
||||
url = post.getUrl();
|
||||
} else {
|
||||
url = preview.getPreviewUrl();
|
||||
}
|
||||
RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(url).listener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|
||||
((PostWithPreviewTypeViewHolder) holder).progressBar.setVisibility(View.GONE);
|
||||
|
@ -199,6 +199,9 @@ public class ParsePost {
|
||||
nComments, flair, awards, nAwards, hidden, spoiler, nsfw, stickied, archived,
|
||||
locked, saved, isCrosspost);
|
||||
|
||||
if (previews.isEmpty()) {
|
||||
previews.add(new Post.Preview(url, 0, 0));
|
||||
}
|
||||
post.setPreviews(previews);
|
||||
} else {
|
||||
//No preview link post
|
||||
@ -278,6 +281,9 @@ public class ParsePost {
|
||||
voteType, nComments, flair, awards, nAwards, hidden, spoiler, nsfw,
|
||||
stickied, archived, locked, saved, isCrosspost);
|
||||
|
||||
if (previews.isEmpty()) {
|
||||
previews.add(new Post.Preview(url, 0, 0));
|
||||
}
|
||||
post.setPreviews(previews);
|
||||
} else if (url.endsWith("gif")){
|
||||
//Gif post
|
||||
@ -359,6 +365,10 @@ public class ParsePost {
|
||||
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score, postType,
|
||||
voteType, nComments, flair, awards, nAwards, hidden, spoiler, nsfw, stickied,
|
||||
archived, locked, saved, isCrosspost);
|
||||
|
||||
if (previews.isEmpty()) {
|
||||
previews.add(new Post.Preview(url, 0, 0));
|
||||
}
|
||||
post.setPreviews(previews);
|
||||
} else if (url.endsWith("mp4")) {
|
||||
//Video post
|
||||
|
Loading…
Reference in New Issue
Block a user