From e569b6aa5cbed15e8e4e535831e0d02e6ab6f415 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Thu, 10 Oct 2019 18:43:48 +0200 Subject: [PATCH] fix avatars with non-square aspect ratio display (#1528) --- .../com/keylesspalace/tusky/util/ImageLoadingHelper.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/util/ImageLoadingHelper.kt b/app/src/main/java/com/keylesspalace/tusky/util/ImageLoadingHelper.kt index 77a765a1..1ab3e374 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/ImageLoadingHelper.kt +++ b/app/src/main/java/com/keylesspalace/tusky/util/ImageLoadingHelper.kt @@ -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)