aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Post/ParsePost.java10
2 files changed, 20 insertions, 2 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
index 164b283e..ac223d3d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
@@ -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);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Post/ParsePost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Post/ParsePost.java
index 9f77fdda..64c1ad98 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Post/ParsePost.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Post/ParsePost.java
@@ -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