diff options
Diffstat (limited to 'app/src/main/java/ml/docilealligator/infinityforreddit')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java | 27 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java | 1 |
2 files changed, 25 insertions, 3 deletions
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 d63c42d3..ffdc4328 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java @@ -284,7 +284,14 @@ public class ParsePost { spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); if (previews.isEmpty()) { - previews.add(new Post.Preview(url, 0, 0, "", "")); + if ("i.redgifs.com".equals(uri.getAuthority())) { + //No preview link (Not able to load redgifs image) + post.setPostType(Post.NO_PREVIEW_LINK_TYPE); + } else { + previews.add(new Post.Preview(url, 0, 0, "", "")); + } + } else if ("i.redgifs.com".equals(uri.getAuthority())) { + post.setUrl(previews.get(previews.size() - 1).getPreviewUrl()); } post.setPreviews(previews); } else { @@ -423,7 +430,14 @@ public class ParsePost { distinguished, suggestedSort); if (previews.isEmpty()) { - previews.add(new Post.Preview(url, 0, 0, "", "")); + if ("i.redgifs.com".equals(uri.getAuthority())) { + //No preview link (Not able to load redgifs image) + post.setPostType(Post.NO_PREVIEW_LINK_TYPE); + } else { + previews.add(new Post.Preview(url, 0, 0, "", "")); + } + } else if ("i.redgifs.com".equals(uri.getAuthority())) { + post.setUrl(previews.get(previews.size() - 1).getPreviewUrl()); } post.setPreviews(previews); } else if (path.endsWith(".gif")) { @@ -533,7 +547,14 @@ public class ParsePost { spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); if (previews.isEmpty()) { - previews.add(new Post.Preview(url, 0, 0, "", "")); + if ("i.redgifs.com".equals(uri.getAuthority())) { + //No preview link (Not able to load redgifs image) + post.setPostType(Post.NO_PREVIEW_LINK_TYPE); + } else { + previews.add(new Post.Preview(url, 0, 0, "", "")); + } + } else if ("i.redgifs.com".equals(uri.getAuthority())) { + post.setUrl(previews.get(previews.size() - 1).getPreviewUrl()); } post.setPreviews(previews); } else if (path.endsWith(".mp4")) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java index 90577a2c..0916775b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java @@ -82,6 +82,7 @@ public class Post implements Parcelable { private ArrayList<Preview> previews = new ArrayList<>(); private ArrayList<Gallery> gallery = new ArrayList<>(); + //Text and video posts public Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author, String authorFlair, String authorFlairHTML, long postTimeMillis, String title, String permalink, int score, int postType, int voteType, int nComments, |