Files
forkmessager/client-mobile/core/utils/CoilUtils.kt
Халимов Рустам 2d0bc0d75c Чат, правки
2026-04-14 12:52:03 +03:00

27 lines
734 B
Kotlin

package core.utils
import android.content.Context
import android.os.Build
import coil.ImageLoader
import coil.decode.GifDecoder
import coil.decode.ImageDecoderDecoder
object CoilUtils {
private var gifImageLoader: ImageLoader? = null
fun getGifImageLoader(context: Context): ImageLoader {
if (gifImageLoader == null) {
gifImageLoader = ImageLoader.Builder(context)
.components {
if (Build.VERSION.SDK_INT >= 28) {
add(ImageDecoderDecoder.Factory())
} else {
add(GifDecoder.Factory())
}
}
.build()
}
return gifImageLoader!!
}
}