diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-07-21 11:39:06 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-07-21 11:39:06 +0000 |
commit | fa114261019c7e4ba33a0affbd712eee9c99a348 (patch) | |
tree | 63de055851b1b9be5c358a1b6e3fbbec63eb8535 /app/src/main/java | |
parent | b36a99da6dd6a529e154f8e4d7e3ab8dc827045e (diff) | |
download | infinity-for-reddit-fa114261019c7e4ba33a0affbd712eee9c99a348.tar infinity-for-reddit-fa114261019c7e4ba33a0affbd712eee9c99a348.tar.gz infinity-for-reddit-fa114261019c7e4ba33a0affbd712eee9c99a348.tar.bz2 infinity-for-reddit-fa114261019c7e4ba33a0affbd712eee9c99a348.tar.lz infinity-for-reddit-fa114261019c7e4ba33a0affbd712eee9c99a348.tar.xz infinity-for-reddit-fa114261019c7e4ba33a0affbd712eee9c99a348.tar.zst infinity-for-reddit-fa114261019c7e4ba33a0affbd712eee9c99a348.zip |
Maybe fix nsfw gif cannot be blurred in PostDetailRecyclerViewAdapter.
Diffstat (limited to '')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java index 2f749083..4e432c5a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -867,7 +867,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler private void loadImage(PostDetailBaseViewHolder holder, @NonNull Post.Preview preview) { if (holder instanceof PostDetailImageAndGifAutoplayViewHolder) { - String url = mPost.getPostType() == Post.IMAGE_TYPE ? preview.getPreviewUrl() : mPost.getUrl(); + boolean blurImage = (mPost.isNSFW() && mNeedBlurNsfw && !(mDoNotBlurNsfwInNsfwSubreddits && mFragment != null && mFragment.getIsNsfwSubreddit()) && !(mPost.getPostType() == Post.GIF_TYPE && mAutoplayNsfwVideos)) || (mPost.isSpoiler() && mNeedBlurSpoiler); + String url = mPost.getPostType() == Post.IMAGE_TYPE || blurImage ? preview.getPreviewUrl() : mPost.getUrl(); RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(url) .listener(new RequestListener<Drawable>() { @Override @@ -889,7 +890,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler } }); - if ((mPost.isNSFW() && mNeedBlurNsfw && !(mDoNotBlurNsfwInNsfwSubreddits && mFragment != null && mFragment.getIsNsfwSubreddit()) && !(mPost.getPostType() == Post.GIF_TYPE && mAutoplayNsfwVideos)) || (mPost.isSpoiler() && mNeedBlurSpoiler)) { + if (blurImage) { imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))).into(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView); } else { if (mImageViewWidth > preview.getPreviewWidth()) { |