From 5285e1ccf2b5eeb07f8c424ec0cd6b27a7232993 Mon Sep 17 00:00:00 2001 From: FooIbar <118464521+FooIbar@users.noreply.github.com> Date: Wed, 10 Jan 2024 20:45:42 +0800 Subject: [PATCH] Update coil to 3.0.0-alpha02 --- app/src/main/kotlin/com/hippo/ehviewer/EhApplication.kt | 7 ++----- app/src/main/kotlin/com/hippo/ehviewer/image/Image.kt | 6 +----- gradle/libs.versions.toml | 2 +- settings.gradle.kts | 1 - 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/app/src/main/kotlin/com/hippo/ehviewer/EhApplication.kt b/app/src/main/kotlin/com/hippo/ehviewer/EhApplication.kt index 520bab47b..74ae513b9 100644 --- a/app/src/main/kotlin/com/hippo/ehviewer/EhApplication.kt +++ b/app/src/main/kotlin/com/hippo/ehviewer/EhApplication.kt @@ -29,8 +29,7 @@ import androidx.lifecycle.ProcessLifecycleOwner import androidx.lifecycle.coroutineScope import coil3.SingletonImageLoader import coil3.asCoilImage -import coil3.gif.AnimatedImageDecoderDecoder -import coil3.gif.GifDecoder +import coil3.gif.AnimatedImageDecoder import coil3.network.NetworkFetcher import coil3.request.crossfade import coil3.serviceLoaderEnabled @@ -189,9 +188,7 @@ class EhApplication : Application(), SingletonImageLoader.Factory { add(MergeInterceptor) add(DownloadThumbInterceptor) if (isAtLeastP) { - add(AnimatedImageDecoderDecoder.Factory(false)) - } else { - add(GifDecoder.Factory()) + add(AnimatedImageDecoder.Factory(false)) } } diskCache(imageCache) diff --git a/app/src/main/kotlin/com/hippo/ehviewer/image/Image.kt b/app/src/main/kotlin/com/hippo/ehviewer/image/Image.kt index 4d6d9d606..e2531c9f1 100644 --- a/app/src/main/kotlin/com/hippo/ehviewer/image/Image.kt +++ b/app/src/main/kotlin/com/hippo/ehviewer/image/Image.kt @@ -109,11 +109,7 @@ class Image private constructor(image: CoilImage, private val src: AutoCloseable private suspend fun Either.decodeCoil(): CoilImage { val req = appCtx.imageRequest { onLeft { data(it.source) } - onRight { - // Workaround https://github.com/coil-kt/coil/issues/2006 - val uri = it.source.uri - data(if (UniFile.isFileUri(uri)) uri.path else uri) - } + onRight { data(it.source.uri) } size(targetWidth, targetHeight) scale(Scale.FILL) precision(Precision.INEXACT) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 84da9ca33..3811d3115 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,7 +16,7 @@ androidx-recyclerview = "1.3.2" androidx-room = "2.6.1" androidx-work = "2.9.0" arrow = "1.2.1" -coil = "3.0.0-SNAPSHOT" +coil = "3.0.0-alpha02" compose-bom = "2023.12.00-alpha04" compose-compiler = "1.5.8-dev-k2.0.0-Beta2-99ed868a0f8" compose-destinations = "1.9.57" diff --git a/settings.gradle.kts b/settings.gradle.kts index a02d54161..448859d8b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -12,7 +12,6 @@ dependencyResolutionManagement { repositories { google() mavenCentral() - maven("https://oss.sonatype.org/content/repositories/snapshots") maven("https://jitpack.io") maven("https://androidx.dev/storage/compose-compiler/repository/") maven("https://androidx.dev/snapshots/builds/11271125/artifacts/repository")