Чат, правки
This commit is contained in:
26
client-mobile/core/utils/CoilUtils.kt
Normal file
26
client-mobile/core/utils/CoilUtils.kt
Normal file
@@ -0,0 +1,26 @@
|
||||
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!!
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user