From 81057213db0761299c778a0d344250e6c0f88559 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Fri, 21 May 2021 17:52:03 +0200 Subject: [PATCH] don't upscale images in caption dialog (#2165) * don't upscale images in caption dialog * don't upscale images in caption dialog --- .../tusky/components/compose/dialog/CaptionDialog.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/compose/dialog/CaptionDialog.kt b/app/src/main/java/com/keylesspalace/tusky/components/compose/dialog/CaptionDialog.kt index e356cd3f..adc72cd3 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/compose/dialog/CaptionDialog.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/compose/dialog/CaptionDialog.kt @@ -31,6 +31,7 @@ import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.LiveData import at.connyduck.sparkbutton.helpers.Utils import com.bumptech.glide.Glide +import com.bumptech.glide.load.resource.bitmap.DownsampleStrategy import com.bumptech.glide.request.target.CustomTarget import com.bumptech.glide.request.transition.Transition import com.github.chrisbanes.photoview.PhotoView @@ -97,10 +98,10 @@ fun T.makeCaptionDialog(existingDescription: String?, dialog.show() - // Load the image and manually set it into the ImageView because it doesn't have a fixed - // size. Maybe we should limit the size of CustomTarget + // Load the image and manually set it into the ImageView because it doesn't have a fixed size. Glide.with(this) .load(previewUri) + .downsample(DownsampleStrategy.CENTER_INSIDE) .into(object : CustomTarget(4096, 4096) { override fun onLoadCleared(placeholder: Drawable?) { imageView.setImageDrawable(placeholder)