don't upscale images in caption dialog (#2165)
* don't upscale images in caption dialog * don't upscale images in caption dialog
This commit is contained in:
parent
387e62ea4b
commit
81057213db
1 changed files with 3 additions and 2 deletions
|
@ -31,6 +31,7 @@ import androidx.lifecycle.LifecycleOwner
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import at.connyduck.sparkbutton.helpers.Utils
|
import at.connyduck.sparkbutton.helpers.Utils
|
||||||
import com.bumptech.glide.Glide
|
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.target.CustomTarget
|
||||||
import com.bumptech.glide.request.transition.Transition
|
import com.bumptech.glide.request.transition.Transition
|
||||||
import com.github.chrisbanes.photoview.PhotoView
|
import com.github.chrisbanes.photoview.PhotoView
|
||||||
|
@ -97,10 +98,10 @@ fun <T> T.makeCaptionDialog(existingDescription: String?,
|
||||||
|
|
||||||
dialog.show()
|
dialog.show()
|
||||||
|
|
||||||
// Load the image and manually set it into the ImageView because it doesn't have a fixed
|
// Load the image and manually set it into the ImageView because it doesn't have a fixed size.
|
||||||
// size. Maybe we should limit the size of CustomTarget
|
|
||||||
Glide.with(this)
|
Glide.with(this)
|
||||||
.load(previewUri)
|
.load(previewUri)
|
||||||
|
.downsample(DownsampleStrategy.CENTER_INSIDE)
|
||||||
.into(object : CustomTarget<Drawable>(4096, 4096) {
|
.into(object : CustomTarget<Drawable>(4096, 4096) {
|
||||||
override fun onLoadCleared(placeholder: Drawable?) {
|
override fun onLoadCleared(placeholder: Drawable?) {
|
||||||
imageView.setImageDrawable(placeholder)
|
imageView.setImageDrawable(placeholder)
|
||||||
|
|
Loading…
Reference in a new issue