Fix image loading
This commit is contained in:
parent
e49156fb11
commit
137ef3fee4
|
@ -251,6 +251,7 @@ dependencies {
|
||||||
|
|
||||||
// Image loading
|
// Image loading
|
||||||
implementation libs.coil.compose
|
implementation libs.coil.compose
|
||||||
|
implementation libs.coil.network.okhttp
|
||||||
|
|
||||||
// Markdown library for Android
|
// Markdown library for Android
|
||||||
implementation libs.markwon.core
|
implementation libs.markwon.core
|
||||||
|
|
|
@ -10,6 +10,7 @@ import androidx.core.content.getSystemService
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import coil3.ImageLoader
|
import coil3.ImageLoader
|
||||||
import coil3.SingletonImageLoader
|
import coil3.SingletonImageLoader
|
||||||
|
import coil3.network.okhttp.OkHttpNetworkFetcherFactory
|
||||||
import coil3.request.allowRgb565
|
import coil3.request.allowRgb565
|
||||||
import coil3.request.crossfade
|
import coil3.request.crossfade
|
||||||
import coil3.util.DebugLogger
|
import coil3.util.DebugLogger
|
||||||
|
@ -123,7 +124,9 @@ open class App :
|
||||||
.logger(if (BuildConfig.DEBUG) DebugLogger() else null)
|
.logger(if (BuildConfig.DEBUG) DebugLogger() else null)
|
||||||
.allowRgb565(getSystemService<ActivityManager>()!!.isLowRamDevice)
|
.allowRgb565(getSystemService<ActivityManager>()!!.isLowRamDevice)
|
||||||
.crossfade(true)
|
.crossfade(true)
|
||||||
.build()
|
.components {
|
||||||
|
add(OkHttpNetworkFetcherFactory(callFactory = DownloaderImpl.getInstance().client))
|
||||||
|
}.build()
|
||||||
|
|
||||||
protected open fun getDownloader(): Downloader {
|
protected open fun getDownloader(): Downloader {
|
||||||
val downloader = DownloaderImpl.init(null)
|
val downloader = DownloaderImpl.init(null)
|
||||||
|
|
|
@ -48,6 +48,11 @@ public final class DownloaderImpl extends Downloader {
|
||||||
this.mCookies = new HashMap<>();
|
this.mCookies = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public OkHttpClient getClient() {
|
||||||
|
return client;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It's recommended to call exactly once in the entire lifetime of the application.
|
* It's recommended to call exactly once in the entire lifetime of the application.
|
||||||
*
|
*
|
||||||
|
|
|
@ -8,7 +8,7 @@ auto-service = "1.1.1"
|
||||||
bridge = "2.0.2"
|
bridge = "2.0.2"
|
||||||
cardview = "1.0.0"
|
cardview = "1.0.0"
|
||||||
checkstyle = "10.12.1"
|
checkstyle = "10.12.1"
|
||||||
coil = "3.0.3"
|
coil = "3.0.4"
|
||||||
constraintlayout = "2.1.4"
|
constraintlayout = "2.1.4"
|
||||||
core-ktx = "1.12.0"
|
core-ktx = "1.12.0"
|
||||||
desugar-jdk-libs-nio = "2.0.4"
|
desugar-jdk-libs-nio = "2.0.4"
|
||||||
|
@ -110,6 +110,7 @@ assertj-core = { group = "org.assertj", name = "assertj-core", version.ref = "as
|
||||||
auto-service = { group = "com.google.auto.service", name = "auto-service-annotations", version.ref = "auto-service" }
|
auto-service = { group = "com.google.auto.service", name = "auto-service-annotations", version.ref = "auto-service" }
|
||||||
auto-service-kapt = { group = "com.google.auto.service", name = "auto-service", version.ref = "auto-service" }
|
auto-service-kapt = { group = "com.google.auto.service", name = "auto-service", version.ref = "auto-service" }
|
||||||
coil-compose = { group = "io.coil-kt.coil3", name = 'coil-compose', version.ref = "coil" }
|
coil-compose = { group = "io.coil-kt.coil3", name = 'coil-compose', version.ref = "coil" }
|
||||||
|
coil-network-okhttp = { group = "io.coil-kt.coil3", name = 'coil-network-okhttp', version.ref = "coil" }
|
||||||
desugar-jdk-libs-nio = { group = "com.android.tools", name = "desugar_jdk_libs_nio", version.ref = "desugar-jdk-libs-nio" }
|
desugar-jdk-libs-nio = { group = "com.android.tools", name = "desugar_jdk_libs_nio", version.ref = "desugar-jdk-libs-nio" }
|
||||||
exoplayer-core = { group = "com.google.android.exoplayer", name = "exoplayer-core", version.ref = "exoplayer" }
|
exoplayer-core = { group = "com.google.android.exoplayer", name = "exoplayer-core", version.ref = "exoplayer" }
|
||||||
exoplayer-database = { group = "com.google.android.exoplayer", name = "exoplayer-database", version.ref = "exoplayer" }
|
exoplayer-database = { group = "com.google.android.exoplayer", name = "exoplayer-database", version.ref = "exoplayer" }
|
||||||
|
|
Loading…
Reference in New Issue