diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2023-09-14 03:56:59 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2023-09-14 03:56:59 +0000 |
commit | 1292a8b40a2cbbdcc9a811b3aa0c13912662923a (patch) | |
tree | 7ca371129b3d7f8db64075261254a4480478167b /app/src/main/java | |
parent | 4bf0ff5e7b30508b56f33b3ded0f9471c52760a2 (diff) | |
download | infinity-for-reddit-1292a8b40a2cbbdcc9a811b3aa0c13912662923a.tar infinity-for-reddit-1292a8b40a2cbbdcc9a811b3aa0c13912662923a.tar.gz infinity-for-reddit-1292a8b40a2cbbdcc9a811b3aa0c13912662923a.tar.bz2 infinity-for-reddit-1292a8b40a2cbbdcc9a811b3aa0c13912662923a.tar.lz infinity-for-reddit-1292a8b40a2cbbdcc9a811b3aa0c13912662923a.tar.xz infinity-for-reddit-1292a8b40a2cbbdcc9a811b3aa0c13912662923a.tar.zst infinity-for-reddit-1292a8b40a2cbbdcc9a811b3aa0c13912662923a.zip |
Continue adding Card Layout 3.
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java | 20 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java | 1 |
2 files changed, 20 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java index 0b605ec7..f2abbf7c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java @@ -2055,6 +2055,26 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy imageRequestBuilder.centerInside().downsample(mSaveMemoryCenterInsideDownsampleStrategy).into(((PostCard2WithPreviewViewHolder) holder).imageView); } } + } else if (holder instanceof PostMaterial3CardWithPreviewViewHolder) { + Post post = ((PostMaterial3CardWithPreviewViewHolder) holder).post; + Post.Preview preview = ((PostMaterial3CardWithPreviewViewHolder) holder).preview; + if (preview != null) { + String url; + boolean blurImage = (post.isNSFW() && mNeedBlurNsfw && !(post.getPostType() == Post.GIF_TYPE && mAutoplay && mAutoplayNsfwVideos)) || (post.isSpoiler() && mNeedBlurSpoiler); + if (post.getPostType() == Post.GIF_TYPE && mAutoplay && !blurImage) { + url = post.getUrl(); + } else { + url = preview.getPreviewUrl(); + } + RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(url).listener(((PostMaterial3CardWithPreviewViewHolder) holder).glideRequestListener); + + if (blurImage) { + imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))) + .into(((PostMaterial3CardWithPreviewViewHolder) holder).binding.imageViewItemPostCard3WithPreview); + } else { + imageRequestBuilder.centerInside().downsample(mSaveMemoryCenterInsideDownsampleStrategy).into(((PostMaterial3CardWithPreviewViewHolder) holder).binding.imageViewItemPostCard3WithPreview); + } + } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java index 72f6df70..0293ad5b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java @@ -23,7 +23,6 @@ public class APIUtils { public static final String IMGUR_API_BASE_URI = "https://api.imgur.com/3/"; public static final String PUSHSHIFT_API_BASE_URI = "https://api.pushshift.io/"; public static final String REVEDDIT_API_BASE_URI = "https://api.reveddit.com/"; - public static final String STRAPI_BASE_URI = "https://strapi.reddit.com"; public static final String STREAMABLE_API_BASE_URI = "https://api.streamable.com"; public static final String CLIENT_ID_KEY = "client_id"; |