aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2023-02-06 18:53:21 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2023-02-06 18:53:21 +0000
commite88c2e957bd5ba6cd703e05d5aa86c19ef049039 (patch)
tree3b4561041e453368b0b5e45d37ad6b072d8b2fd1
parentc7882b1f65919cc27bb9e17fb0acc6041857ad97 (diff)
downloadinfinity-for-reddit-e88c2e957bd5ba6cd703e05d5aa86c19ef049039.tar
infinity-for-reddit-e88c2e957bd5ba6cd703e05d5aa86c19ef049039.tar.gz
infinity-for-reddit-e88c2e957bd5ba6cd703e05d5aa86c19ef049039.tar.bz2
infinity-for-reddit-e88c2e957bd5ba6cd703e05d5aa86c19ef049039.tar.lz
infinity-for-reddit-e88c2e957bd5ba6cd703e05d5aa86c19ef049039.tar.xz
infinity-for-reddit-e88c2e957bd5ba6cd703e05d5aa86c19ef049039.tar.zst
infinity-for-reddit-e88c2e957bd5ba6cd703e05d5aa86c19ef049039.zip
Version 5.4.0. Minor bugs fixed in PostGalleryTypeImageRecyclerViewAdapter.
Diffstat (limited to '')
-rw-r--r--app/build.gradle4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java15
2 files changed, 14 insertions, 5 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 8248b4c8..d15135ec 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -8,8 +8,8 @@ android {
applicationId "ml.docilealligator.infinityforreddit"
minSdk 21
targetSdk 33
- versionCode 113
- versionName "5.4.0-beta4"
+ versionCode 114
+ versionName "5.4.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java
index 02ff29ce..f5ec7c13 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java
@@ -123,8 +123,12 @@ public class PostGalleryTypeImageRecyclerViewAdapter extends RecyclerView.Adapte
if (galleryImages == null || galleryImages.isEmpty()) {
return;
}
+ int index = holder.getBindingAdapterPosition();
+ if (index < 0 || index >= galleryImages.size()) {
+ return;
+ }
- RequestBuilder<Drawable> imageRequestBuilder = glide.load(galleryImages.get(holder.getBindingAdapterPosition()).url).listener(new RequestListener<>() {
+ RequestBuilder<Drawable> imageRequestBuilder = glide.load(galleryImages.get(index).url).listener(new RequestListener<>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
holder.binding.progressBarItemGalleryImageInPostFeed.setVisibility(View.GONE);
@@ -152,8 +156,13 @@ public class PostGalleryTypeImageRecyclerViewAdapter extends RecyclerView.Adapte
return;
}
- String previewCaption = galleryImages.get(holder.getBindingAdapterPosition()).caption;
- String previewCaptionUrl = galleryImages.get(holder.getBindingAdapterPosition()).captionUrl;
+ int index = holder.getBindingAdapterPosition();
+ if (index < 0 || index >= galleryImages.size()) {
+ return;
+ }
+
+ String previewCaption = galleryImages.get(index).caption;
+ String previewCaptionUrl = galleryImages.get(index).captionUrl;
boolean previewCaptionIsEmpty = TextUtils.isEmpty(previewCaption);
boolean previewCaptionUrlIsEmpty = TextUtils.isEmpty(previewCaptionUrl);
if (!previewCaptionIsEmpty || !previewCaptionUrlIsEmpty) {