|
|
@ -5,12 +5,12 @@ package com.keylesspalace.tusky.util |
|
|
|
import android.widget.ImageView |
|
|
|
import android.widget.ImageView |
|
|
|
import androidx.annotation.Px |
|
|
|
import androidx.annotation.Px |
|
|
|
import com.bumptech.glide.Glide |
|
|
|
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.bumptech.glide.load.resource.bitmap.RoundedCorners |
|
|
|
import com.keylesspalace.tusky.R |
|
|
|
import com.keylesspalace.tusky.R |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private val fitCenterTransformation = FitCenter() |
|
|
|
private val centerCropTransformation = CenterCrop() |
|
|
|
|
|
|
|
|
|
|
|
fun loadAvatar(url: String?, imageView: ImageView, @Px radius: Int, animate: Boolean) { |
|
|
|
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) |
|
|
|
Glide.with(imageView) |
|
|
|
.load(url) |
|
|
|
.load(url) |
|
|
|
.transform( |
|
|
|
.transform( |
|
|
|
fitCenterTransformation, |
|
|
|
centerCropTransformation, |
|
|
|
RoundedCorners(radius) |
|
|
|
RoundedCorners(radius) |
|
|
|
) |
|
|
|
) |
|
|
|
.placeholder(R.drawable.avatar_default) |
|
|
|
.placeholder(R.drawable.avatar_default) |
|
|
@ -34,7 +34,7 @@ fun loadAvatar(url: String?, imageView: ImageView, @Px radius: Int, animate: Boo |
|
|
|
.asBitmap() |
|
|
|
.asBitmap() |
|
|
|
.load(url) |
|
|
|
.load(url) |
|
|
|
.transform( |
|
|
|
.transform( |
|
|
|
fitCenterTransformation, |
|
|
|
centerCropTransformation, |
|
|
|
RoundedCorners(radius) |
|
|
|
RoundedCorners(radius) |
|
|
|
) |
|
|
|
) |
|
|
|
.placeholder(R.drawable.avatar_default) |
|
|
|
.placeholder(R.drawable.avatar_default) |
|
|
|