Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ dependencies {

//Compose Coil
implementation("io.coil-kt:coil-compose:2.6.0")
implementation("io.coil-kt:coil-gif:2.6.0")

// Firebase
implementation platform('com.google.firebase:firebase-bom:32.8.1')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.kickstarter.ui.views

import android.annotation.SuppressLint
import android.content.Context
import android.os.Build.VERSION.SDK_INT
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
Expand All @@ -13,9 +14,15 @@ import androidx.compose.material.LinearProgressIndicator
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale.Companion.FillWidth
import androidx.core.view.isVisible
import coil.ImageLoader
import coil.compose.AsyncImagePainter
import coil.compose.SubcomposeAsyncImage
import coil.compose.SubcomposeAsyncImageContent
import coil.decode.GifDecoder
import coil.decode.ImageDecoderDecoder

import coil.load

import com.kickstarter.R
import com.kickstarter.databinding.ViewImageWithCaptionBinding
import com.kickstarter.libs.utils.extensions.isGif
Expand Down Expand Up @@ -46,7 +53,16 @@ class ImageWithCaptionView @JvmOverloads constructor(
} else {
when {
src.isWebp() -> {
binding.imageView.loadWebp(src, context)
val gifEnabledLoader = ImageLoader.Builder(context)
.components {
if (SDK_INT >= 28) {
add(ImageDecoderDecoder.Factory())
} else {
add(GifDecoder.Factory())
}
}
.build()
binding.imageView.load(src, gifEnabledLoader)
binding.imageView.visibility = VISIBLE
binding.composeViewImage.visibility = GONE
}
Expand Down