Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Commit

Permalink
Update visible images when switching full height and large image styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Tunous committed Aug 2, 2020
1 parent 56c70d5 commit 638f1ba
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.signature.ObjectKey;
import com.google.auto.value.AutoValue;
import com.jakewharton.rxrelay2.PublishRelay;

Expand Down Expand Up @@ -280,7 +281,7 @@ private void setThumbnail(Optional<UiModel.Thumbnail> optionalThumbnail) {
break;
case THUMBNAIL:
imageView.setVisibility(View.GONE);
loadThumbnail(thumb, RequestOptions.circleCropTransform(), thumbnailView);
loadThumbnail(thumb, RequestOptions.circleCropTransform(), thumbnailView, -1);
break;
case LARGE:
setLargeImage(thumb, largeImageHeight);
Expand All @@ -298,12 +299,13 @@ private void setLargeImage(UiModel.Thumbnail thumb, int height) {
layoutParams.height = height;
imageView.setLayoutParams(layoutParams);
thumbnailView.setVisibility(View.GONE);
loadThumbnail(thumb, RequestOptions.centerCropTransform(), imageView);
loadThumbnail(thumb, RequestOptions.centerCropTransform(), imageView, height);
}

private void loadThumbnail(UiModel.Thumbnail thumb, RequestOptions requestOptions, ImageView imageView) {
private void loadThumbnail(UiModel.Thumbnail thumb, RequestOptions requestOptions, ImageView imageView, int height) {
Glide.with(itemView)
.load(thumb.remoteUrl().get())
.signature(new ObjectKey(height))
.apply(requestOptions)
.transition(DrawableTransitionOptions.withCrossFade())
.into(imageView);
Expand Down

0 comments on commit 638f1ba

Please sign in to comment.