mirror of https://github.com/readrops/Readrops.git
Add some cache to Coil
This commit is contained in:
parent
c932022fe6
commit
70d66f3200
|
@ -6,6 +6,7 @@ import android.app.NotificationManager
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import coil.ImageLoader
|
import coil.ImageLoader
|
||||||
import coil.ImageLoaderFactory
|
import coil.ImageLoaderFactory
|
||||||
|
import coil.disk.DiskCache
|
||||||
import com.readrops.api.apiModule
|
import com.readrops.api.apiModule
|
||||||
import com.readrops.db.dbModule
|
import com.readrops.db.dbModule
|
||||||
import org.koin.android.ext.koin.androidContext
|
import org.koin.android.ext.koin.androidContext
|
||||||
|
@ -33,6 +34,12 @@ open class ReadropsApp : Application(), KoinComponent, ImageLoaderFactory {
|
||||||
override fun newImageLoader(): ImageLoader {
|
override fun newImageLoader(): ImageLoader {
|
||||||
return ImageLoader.Builder(this)
|
return ImageLoader.Builder(this)
|
||||||
.okHttpClient { get() }
|
.okHttpClient { get() }
|
||||||
|
.diskCache {
|
||||||
|
DiskCache.Builder()
|
||||||
|
.directory(this.cacheDir.resolve("image_cache"))
|
||||||
|
.maxSizePercent(0.05)
|
||||||
|
.build()
|
||||||
|
}
|
||||||
.crossfade(true)
|
.crossfade(true)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue