diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2023-11-04 02:42:21 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2023-11-04 02:42:21 +0000 |
commit | 66ce42081ca0b2b862abf9ddfc62778dd57bbd0f (patch) | |
tree | 026bb3714f3edbf0de66bcc19e3a548039a0340c /app/src/main/java | |
parent | 975046f923456e3387892b1c53cb27cc74c8ff82 (diff) | |
download | infinity-for-reddit-66ce42081ca0b2b862abf9ddfc62778dd57bbd0f.tar infinity-for-reddit-66ce42081ca0b2b862abf9ddfc62778dd57bbd0f.tar.gz infinity-for-reddit-66ce42081ca0b2b862abf9ddfc62778dd57bbd0f.tar.bz2 infinity-for-reddit-66ce42081ca0b2b862abf9ddfc62778dd57bbd0f.tar.lz infinity-for-reddit-66ce42081ca0b2b862abf9ddfc62778dd57bbd0f.tar.xz infinity-for-reddit-66ce42081ca0b2b862abf9ddfc62778dd57bbd0f.tar.zst infinity-for-reddit-66ce42081ca0b2b862abf9ddfc62778dd57bbd0f.zip |
Not loading images from i.redgifs.com because they are webpages.
Diffstat (limited to 'app/src/main/java')
-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, |