27 lines
734 B
Kotlin
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!!
|
|
}
|
|
}
|