Skip to content

Commit

Permalink
Version 5.4.0. Minor bugs fixed in PostGalleryTypeImageRecyclerViewAd…
Browse files Browse the repository at this point in the history
…apter.
  • Loading branch information
Docile-Alligator committed Feb 6, 2023
1 parent c7882b1 commit e88c2e9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ private void loadImage(ImageViewHolder holder) {
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);
Expand Down Expand Up @@ -152,8 +156,13 @@ private void loadCaptionPreview(ImageViewHolder holder) {
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) {
Expand Down

0 comments on commit e88c2e9

Please sign in to comment.