fix avatars with non-square aspect ratio display (#1528)
This commit is contained in:
parent
f0a2dd4c6a
commit
1e0515f4ab
|
@ -5,12 +5,12 @@ package com.keylesspalace.tusky.util
|
|||
import android.widget.ImageView
|
||||
import androidx.annotation.Px
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.resource.bitmap.FitCenter
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||
import com.keylesspalace.tusky.R
|
||||
|
||||
|
||||
private val fitCenterTransformation = FitCenter()
|
||||
private val centerCropTransformation = CenterCrop()
|
||||
|
||||
fun loadAvatar(url: String?, imageView: ImageView, @Px radius: Int, animate: Boolean) {
|
||||
|
||||
|
@ -23,7 +23,7 @@ fun loadAvatar(url: String?, imageView: ImageView, @Px radius: Int, animate: Boo
|
|||
Glide.with(imageView)
|
||||
.load(url)
|
||||
.transform(
|
||||
fitCenterTransformation,
|
||||
centerCropTransformation,
|
||||
RoundedCorners(radius)
|
||||
)
|
||||
.placeholder(R.drawable.avatar_default)
|
||||
|
@ -34,7 +34,7 @@ fun loadAvatar(url: String?, imageView: ImageView, @Px radius: Int, animate: Boo
|
|||
.asBitmap()
|
||||
.load(url)
|
||||
.transform(
|
||||
fitCenterTransformation,
|
||||
centerCropTransformation,
|
||||
RoundedCorners(radius)
|
||||
)
|
||||
.placeholder(R.drawable.avatar_default)
|
||||
|
|
Loading…
Reference in New Issue