Skip to content

Commit

Permalink
Update to Coil 1.0.0-rc3
Browse files Browse the repository at this point in the history
Turned off -Xjvm-default=all as per Coil release
notes, and started using new `imageLoader` extension
property.
  • Loading branch information
chrisbanes committed Sep 22, 2020
1 parent e80eda0 commit c23db0c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ subprojects {
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"

freeCompilerArgs += "-Xallow-jvm-ir-dependencies"
// Turn on JVM default methods
freeCompilerArgs += "-Xjvm-default=all"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ object Libs {
const val appcompat = "androidx.appcompat:appcompat:1.3.0-alpha02"
}

const val coil = "io.coil-kt:coil:1.0.0-rc2"
const val coil = "io.coil-kt:coil:1.0.0-rc3"

const val truth = "com.google.truth:truth:1.0.1"
const val mockk = "io.mockk:mockk-android:1.10.0"
Expand Down
9 changes: 5 additions & 4 deletions coil/src/main/java/dev/chrisbanes/accompanist/coil/Coil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import androidx.core.graphics.drawable.toBitmap
import coil.Coil
import coil.ImageLoader
import coil.decode.DataSource
import coil.imageLoader
import coil.request.ImageRequest
import coil.request.ImageResult

Expand Down Expand Up @@ -77,7 +78,7 @@ import coil.request.ImageResult
fun CoilImage(
data: Any,
modifier: Modifier = Modifier,
imageLoader: ImageLoader = Coil.imageLoader(ContextAmbient.current),
imageLoader: ImageLoader = ContextAmbient.current.imageLoader,
shouldRefetchOnSizeChange: (currentResult: CoilImageState, size: IntSize) -> Boolean = defaultRefetchOnSizeChangeLambda,
onRequestCompleted: (CoilImageState) -> Unit = emptySuccessLambda,
content: @Composable (imageState: CoilImageState) -> Unit
Expand Down Expand Up @@ -123,7 +124,7 @@ fun CoilImage(
fun CoilImage(
request: ImageRequest,
modifier: Modifier = Modifier,
imageLoader: ImageLoader = Coil.imageLoader(ContextAmbient.current),
imageLoader: ImageLoader = ContextAmbient.current.imageLoader,
shouldRefetchOnSizeChange: (currentResult: CoilImageState, size: IntSize) -> Boolean = defaultRefetchOnSizeChangeLambda,
onRequestCompleted: (CoilImageState) -> Unit = emptySuccessLambda,
content: @Composable (imageState: CoilImageState) -> Unit
Expand Down Expand Up @@ -231,7 +232,7 @@ fun CoilImage(
contentScale: ContentScale = ContentScale.Fit,
colorFilter: ColorFilter? = null,
fadeIn: Boolean = false,
imageLoader: ImageLoader = Coil.imageLoader(ContextAmbient.current),
imageLoader: ImageLoader = ContextAmbient.current.imageLoader,
shouldRefetchOnSizeChange: (currentResult: CoilImageState, size: IntSize) -> Boolean = defaultRefetchOnSizeChangeLambda,
onRequestCompleted: (CoilImageState) -> Unit = emptySuccessLambda,
error: @Composable ((CoilImageState.Error) -> Unit)? = null,
Expand Down Expand Up @@ -301,7 +302,7 @@ fun CoilImage(
contentScale: ContentScale = ContentScale.Fit,
colorFilter: ColorFilter? = null,
fadeIn: Boolean = false,
imageLoader: ImageLoader = Coil.imageLoader(ContextAmbient.current),
imageLoader: ImageLoader = ContextAmbient.current.imageLoader,
shouldRefetchOnSizeChange: (currentResult: CoilImageState, size: IntSize) -> Boolean = defaultRefetchOnSizeChangeLambda,
onRequestCompleted: (CoilImageState) -> Unit = emptySuccessLambda,
error: @Composable ((CoilImageState.Error) -> Unit)? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.unit.toSize
import androidx.core.util.Pools
import coil.Coil
import coil.ImageLoader
import coil.decode.DataSource
import coil.imageLoader
import coil.request.ImageRequest

private const val DefaultTransitionDuration = 1000
Expand Down Expand Up @@ -87,7 +87,7 @@ fun CoilImageWithCrossfade(
alignment: Alignment = Alignment.Center,
contentScale: ContentScale = ContentScale.Fit,
crossfadeDuration: Int = DefaultTransitionDuration,
imageLoader: ImageLoader = Coil.imageLoader(ContextAmbient.current),
imageLoader: ImageLoader = ContextAmbient.current.imageLoader,
shouldRefetchOnSizeChange: (currentResult: CoilImageState, size: IntSize) -> Boolean = defaultRefetchOnSizeChangeLambda,
onRequestCompleted: (CoilImageState) -> Unit = emptySuccessLambda,
error: @Composable ((CoilImageState.Error) -> Unit)? = null,
Expand Down Expand Up @@ -138,7 +138,7 @@ fun CoilImageWithCrossfade(
alignment: Alignment = Alignment.Center,
contentScale: ContentScale = ContentScale.Fit,
crossfadeDuration: Int = DefaultTransitionDuration,
imageLoader: ImageLoader = Coil.imageLoader(ContextAmbient.current),
imageLoader: ImageLoader = ContextAmbient.current.imageLoader,
shouldRefetchOnSizeChange: (currentResult: CoilImageState, size: IntSize) -> Boolean = defaultRefetchOnSizeChangeLambda,
onRequestCompleted: (CoilImageState) -> Unit = emptySuccessLambda,
error: @Composable ((CoilImageState.Error) -> Unit)? = null,
Expand Down

0 comments on commit c23db0c

Please sign in to comment.