Updated to latest coil library

This commit is contained in:
Jays2Kings 2021-04-30 23:00:54 -04:00
parent 86259b8ec3
commit ee42eb347f
24 changed files with 72 additions and 68 deletions

View File

@ -197,10 +197,10 @@ dependencies {
implementation("com.github.inorichi.injekt:injekt-core:65b0440") implementation("com.github.inorichi.injekt:injekt-core:65b0440")
// Image library // Image library
val coilVersion = "0.10.1" val coilVersion = "1.2.1"
implementation("io.coil-kt:coil:${Versions.COIL}") implementation("io.coil-kt:coil:$coilVersion")
implementation("io.coil-kt:coil-gif:${Versions.COIL}") implementation("io.coil-kt:coil-gif:$coilVersion")
implementation("io.coil-kt:coil-svg:${Versions.COIL}") implementation("io.coil-kt:coil-svg:$coilVersion")
// Logging // Logging
implementation("com.jakewharton.timber:timber:${Versions.TIMBER}") implementation("com.jakewharton.timber:timber:${Versions.TIMBER}")

View File

@ -2,7 +2,8 @@ package eu.kanade.tachiyomi.data.cache
import android.content.Context import android.content.Context
import android.text.format.Formatter import android.text.format.Formatter
import coil.Coil import coil.imageLoader
import coil.memory.MemoryCache
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.DatabaseHelper import eu.kanade.tachiyomi.data.database.DatabaseHelper
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
@ -174,7 +175,7 @@ class CoverCache(val context: Context) {
fun setCustomCoverToCache(manga: Manga, inputStream: InputStream) { fun setCustomCoverToCache(manga: Manga, inputStream: InputStream) {
getCustomCoverFile(manga).outputStream().use { getCustomCoverFile(manga).outputStream().use {
inputStream.copyTo(it) inputStream.copyTo(it)
Coil.imageLoader(context).invalidate(manga.key()) context.imageLoader.memoryCache.remove(MemoryCache.Key(manga.key()))
} }
} }
@ -188,7 +189,7 @@ class CoverCache(val context: Context) {
val result = getCustomCoverFile(manga).let { val result = getCustomCoverFile(manga).let {
it.exists() && it.delete() it.exists() && it.delete()
} }
Coil.imageLoader(context).invalidate(manga.key()) context.imageLoader.memoryCache.remove(MemoryCache.Key(manga.key()))
return result return result
} }
@ -213,7 +214,7 @@ class CoverCache(val context: Context) {
fun deleteFromCache(name: String?) { fun deleteFromCache(name: String?) {
if (name.isNullOrEmpty()) return if (name.isNullOrEmpty()) return
val file = getCoverFile(MangaImpl().apply { thumbnail_url = name }) val file = getCoverFile(MangaImpl().apply { thumbnail_url = name })
Coil.imageLoader(context).invalidate(file.name) context.imageLoader.memoryCache.remove(MemoryCache.Key(file.name))
if (file.exists()) file.delete() if (file.exists()) file.delete()
} }
@ -234,7 +235,7 @@ class CoverCache(val context: Context) {
val file = getCoverFile(manga) val file = getCoverFile(manga)
if (deleteCustom) deleteCustomCover(manga) if (deleteCustom) deleteCustomCover(manga)
if (file.exists()) { if (file.exists()) {
Coil.imageLoader(context).invalidate(file.name) context.imageLoader.memoryCache.remove(MemoryCache.Key(file.name))
file.delete() file.delete()
} }
} }

View File

@ -1,6 +1,6 @@
package eu.kanade.tachiyomi.data.image.coil package eu.kanade.tachiyomi.data.image.coil
import coil.bitmappool.BitmapPool import coil.bitmap.BitmapPool
import coil.decode.DataSource import coil.decode.DataSource
import coil.decode.Options import coil.decode.Options
import coil.fetch.FetchResult import coil.fetch.FetchResult

View File

@ -5,9 +5,10 @@ import android.graphics.drawable.Drawable
import android.widget.ImageView import android.widget.ImageView
import coil.Coil import coil.Coil
import coil.ImageLoader import coil.ImageLoader
import coil.request.LoadRequest import coil.imageLoader
import coil.request.LoadRequestBuilder import coil.memory.MemoryCache
import coil.request.RequestDisposable import coil.request.Disposable
import coil.request.ImageRequest
import coil.target.ImageViewTarget import coil.target.ImageViewTarget
import eu.kanade.tachiyomi.data.cache.CoverCache import eu.kanade.tachiyomi.data.cache.CoverCache
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
@ -30,7 +31,7 @@ class LibraryMangaImageTarget(
BitmapFactory.decodeFile(file.path, options) BitmapFactory.decodeFile(file.path, options)
if (options.outWidth == -1 || options.outHeight == -1) { if (options.outWidth == -1 || options.outHeight == -1) {
file.delete() file.delete()
Coil.imageLoader(view.context).invalidate(manga.key()) view.context.imageLoader.memoryCache.remove(MemoryCache.Key(manga.key()))
} }
} }
} }
@ -40,12 +41,12 @@ class LibraryMangaImageTarget(
inline fun ImageView.loadLibraryManga( inline fun ImageView.loadLibraryManga(
manga: Manga, manga: Manga,
imageLoader: ImageLoader = Coil.imageLoader(context), imageLoader: ImageLoader = Coil.imageLoader(context),
builder: LoadRequestBuilder.() -> Unit = {} builder: ImageRequest.Builder.() -> Unit = {}
): RequestDisposable { ): Disposable {
val request = LoadRequest.Builder(context) val request = ImageRequest.Builder(context)
.data(manga) .data(manga)
.target(LibraryMangaImageTarget(this, manga)) .target(LibraryMangaImageTarget(this, manga))
.apply(builder) .apply(builder)
.build() .build()
return imageLoader.execute(request) return imageLoader.enqueue(request)
} }

View File

@ -1,7 +1,7 @@
package eu.kanade.tachiyomi.data.image.coil package eu.kanade.tachiyomi.data.image.coil
import android.webkit.MimeTypeMap import android.webkit.MimeTypeMap
import coil.bitmappool.BitmapPool import coil.bitmap.BitmapPool
import coil.decode.DataSource import coil.decode.DataSource
import coil.decode.Options import coil.decode.Options
import coil.fetch.FetchResult import coil.fetch.FetchResult

View File

@ -12,7 +12,7 @@ import androidx.core.app.NotificationManagerCompat
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import coil.Coil import coil.Coil
import coil.request.CachePolicy import coil.request.CachePolicy
import coil.request.GetRequest import coil.request.ImageRequest
import coil.request.Parameters import coil.request.Parameters
import coil.transform.CircleCropTransformation import coil.transform.CircleCropTransformation
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -138,7 +138,7 @@ class LibraryUpdateNotifier(private val context: Context) {
context.notification(Notifications.CHANNEL_NEW_CHAPTERS) { context.notification(Notifications.CHANNEL_NEW_CHAPTERS) {
setSmallIcon(R.drawable.ic_tachi) setSmallIcon(R.drawable.ic_tachi)
try { try {
val request = GetRequest.Builder(context).data(manga) val request = ImageRequest.Builder(context).data(manga)
.parameters(Parameters.Builder().set(MangaFetcher.onlyCache, true).build()) .parameters(Parameters.Builder().set(MangaFetcher.onlyCache, true).build())
.networkCachePolicy(CachePolicy.READ_ONLY) .networkCachePolicy(CachePolicy.READ_ONLY)
.transformations(CircleCropTransformation()) .transformations(CircleCropTransformation())

View File

@ -8,7 +8,7 @@ import android.os.IBinder
import android.os.PowerManager import android.os.PowerManager
import coil.Coil import coil.Coil
import coil.request.CachePolicy import coil.request.CachePolicy
import coil.request.LoadRequest import coil.request.ImageRequest
import coil.request.Parameters import coil.request.Parameters
import eu.kanade.tachiyomi.data.cache.CoverCache import eu.kanade.tachiyomi.data.cache.CoverCache
import eu.kanade.tachiyomi.data.database.DatabaseHelper import eu.kanade.tachiyomi.data.database.DatabaseHelper
@ -453,12 +453,12 @@ class LibraryUpdateService(
coverCache.deleteFromCache(thumbnailUrl) coverCache.deleteFromCache(thumbnailUrl)
// load new covers in background // load new covers in background
val request = val request =
LoadRequest.Builder(this@LibraryUpdateService).data(manga) ImageRequest.Builder(this@LibraryUpdateService).data(manga)
.memoryCachePolicy(CachePolicy.DISABLED).build() .memoryCachePolicy(CachePolicy.DISABLED).build()
Coil.imageLoader(this@LibraryUpdateService).execute(request) Coil.imageLoader(this@LibraryUpdateService).execute(request)
} else { } else {
val request = val request =
LoadRequest.Builder(this@LibraryUpdateService).data(manga) ImageRequest.Builder(this@LibraryUpdateService).data(manga)
.memoryCachePolicy(CachePolicy.DISABLED) .memoryCachePolicy(CachePolicy.DISABLED)
.parameters(Parameters.Builder().set(MangaFetcher.onlyFetchRemotely, true).build()) .parameters(Parameters.Builder().set(MangaFetcher.onlyFetchRemotely, true).build())
.build() .build()

View File

@ -4,8 +4,8 @@ import android.content.res.ColorStateList
import android.graphics.Color import android.graphics.Color
import android.view.View import android.view.View
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import coil.api.clear import coil.clear
import coil.api.load import coil.load
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.Extension
import eu.kanade.tachiyomi.extension.model.InstallStep import eu.kanade.tachiyomi.extension.model.InstallStep

View File

@ -5,7 +5,7 @@ import android.view.Gravity
import android.view.View import android.view.View
import android.widget.FrameLayout import android.widget.FrameLayout
import androidx.core.view.isVisible import androidx.core.view.isVisible
import coil.api.clear import coil.clear
import coil.size.Precision import coil.size.Precision
import coil.size.Scale import coil.size.Scale
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga

View File

@ -3,7 +3,7 @@ package eu.kanade.tachiyomi.ui.library
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.view.isVisible import androidx.core.view.isVisible
import coil.api.clear import coil.clear
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.image.coil.loadLibraryManga import eu.kanade.tachiyomi.data.image.coil.loadLibraryManga
import eu.kanade.tachiyomi.databinding.MangaListItemBinding import eu.kanade.tachiyomi.databinding.MangaListItemBinding

View File

@ -4,7 +4,7 @@ import android.app.Dialog
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import androidx.core.view.isVisible import androidx.core.view.isVisible
import coil.api.loadAny import coil.loadAny
import coil.request.Parameters import coil.request.Parameters
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.customview.customView import com.afollestad.materialdialogs.customview.customView

View File

@ -41,7 +41,8 @@ import androidx.transition.ChangeImageTransform
import androidx.transition.TransitionManager import androidx.transition.TransitionManager
import androidx.transition.TransitionSet import androidx.transition.TransitionSet
import coil.Coil import coil.Coil
import coil.request.LoadRequest import coil.imageLoader
import coil.request.ImageRequest
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.checkbox.checkBoxPrompt import com.afollestad.materialdialogs.checkbox.checkBoxPrompt
import com.afollestad.materialdialogs.checkbox.isCheckPromptChecked import com.afollestad.materialdialogs.checkbox.isCheckPromptChecked
@ -325,7 +326,7 @@ class MangaDetailsController :
fun setPaletteColor() { fun setPaletteColor() {
val view = view ?: return val view = view ?: return
val request = LoadRequest.Builder(view.context).data(presenter.manga).allowHardware(false) val request = ImageRequest.Builder(view.context).data(presenter.manga).allowHardware(false)
.target( .target(
onSuccess = { drawable -> onSuccess = { drawable ->
val bitmap = (drawable as BitmapDrawable).bitmap val bitmap = (drawable as BitmapDrawable).bitmap
@ -358,7 +359,7 @@ class MangaDetailsController :
} }
} }
).build() ).build()
Coil.imageLoader(view.context).execute(request) view.context.imageLoader.enqueue(request)
} }
/** Set toolbar theme for themes that are inverted (ie. light blue theme) */ /** Set toolbar theme for themes that are inverted (ie. light blue theme) */
@ -856,7 +857,7 @@ class MangaDetailsController :
override fun prepareToShareManga() { override fun prepareToShareManga() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
val request = LoadRequest.Builder(activity!!).data(manga).target( val request = ImageRequest.Builder(activity!!).data(manga).target(
onError = { onError = {
shareManga() shareManga()
}, },
@ -864,7 +865,7 @@ class MangaDetailsController :
presenter.shareManga((it as BitmapDrawable).bitmap) presenter.shareManga((it as BitmapDrawable).bitmap)
} }
).build() ).build()
Coil.imageLoader(activity!!).execute(request) Coil.imageLoader(activity!!).enqueue(request)
} else { } else {
shareManga() shareManga()
} }

View File

@ -6,7 +6,7 @@ import android.net.Uri
import android.os.Environment import android.os.Environment
import coil.Coil import coil.Coil
import coil.request.CachePolicy import coil.request.CachePolicy
import coil.request.GetRequest import coil.request.ImageRequest
import coil.request.Parameters import coil.request.Parameters
import coil.request.SuccessResult import coil.request.SuccessResult
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -354,7 +354,7 @@ class MangaDetailsPresenter(
launchIO { launchIO {
val request = val request =
GetRequest.Builder(preferences.context).data(manga) ImageRequest.Builder(preferences.context).data(manga)
.memoryCachePolicy(CachePolicy.DISABLED) .memoryCachePolicy(CachePolicy.DISABLED)
.parameters( .parameters(
Parameters.Builder().set(MangaFetcher.onlyFetchRemotely, true) Parameters.Builder().set(MangaFetcher.onlyFetchRemotely, true)

View File

@ -10,11 +10,13 @@ import androidx.core.content.ContextCompat
import androidx.core.graphics.ColorUtils import androidx.core.graphics.ColorUtils
import androidx.core.view.isInvisible import androidx.core.view.isInvisible
import androidx.core.view.isVisible import androidx.core.view.isVisible
import coil.api.loadAny import coil.loadAny
import coil.request.CachePolicy import coil.request.CachePolicy
import coil.request.Parameters
import com.google.android.material.button.MaterialButton import com.google.android.material.button.MaterialButton
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.image.coil.MangaFetcher
import eu.kanade.tachiyomi.databinding.MangaHeaderItemBinding import eu.kanade.tachiyomi.databinding.MangaHeaderItemBinding
import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga

View File

@ -5,8 +5,8 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ArrayAdapter import android.widget.ArrayAdapter
import androidx.core.view.isVisible import androidx.core.view.isVisible
import coil.api.clear import coil.clear
import coil.api.load import coil.load
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.data.track.model.TrackSearch
import eu.kanade.tachiyomi.databinding.TrackSearchItemBinding import eu.kanade.tachiyomi.databinding.TrackSearchItemBinding

View File

@ -2,8 +2,8 @@ package eu.kanade.tachiyomi.ui.migration
import android.view.View import android.view.View
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import coil.api.clear import coil.clear
import coil.api.loadAny import coil.loadAny
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.databinding.MangaListItemBinding import eu.kanade.tachiyomi.databinding.MangaListItemBinding

View File

@ -6,7 +6,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.isInvisible import androidx.core.view.isInvisible
import androidx.core.view.isVisible import androidx.core.view.isVisible
import coil.Coil import coil.Coil
import coil.request.LoadRequest import coil.request.ImageRequest
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.DatabaseHelper import eu.kanade.tachiyomi.data.database.DatabaseHelper
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
@ -136,9 +136,9 @@ class MigrationProcessHolder(
(root.layoutParams as ConstraintLayout.LayoutParams).verticalBias = 1f (root.layoutParams as ConstraintLayout.LayoutParams).verticalBias = 1f
progress.isVisible = false progress.isVisible = false
val request = LoadRequest.Builder(view.context).data(manga) val request = ImageRequest.Builder(view.context).data(manga)
.target(CoverViewTarget(coverThumbnail, progress)).build() .target(CoverViewTarget(coverThumbnail, progress)).build()
Coil.imageLoader(view.context).execute(request) Coil.imageLoader(view.context).enqueue(request)
compactTitle.isVisible = true compactTitle.isVisible = true
gradient.isVisible = true gradient.isVisible = true

View File

@ -7,7 +7,7 @@ import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import coil.Coil import coil.Coil
import coil.request.CachePolicy import coil.request.CachePolicy
import coil.request.LoadRequest import coil.request.ImageRequest
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.notification.NotificationHandler import eu.kanade.tachiyomi.data.notification.NotificationHandler
import eu.kanade.tachiyomi.data.notification.NotificationReceiver import eu.kanade.tachiyomi.data.notification.NotificationReceiver
@ -38,7 +38,7 @@ class SaveImageNotifier(private val context: Context) {
* @param file image file containing downloaded page image. * @param file image file containing downloaded page image.
*/ */
fun onComplete(file: File) { fun onComplete(file: File) {
val request = LoadRequest.Builder(context).memoryCachePolicy(CachePolicy.DISABLED).diskCachePolicy(CachePolicy.DISABLED) val request = ImageRequest.Builder(context).memoryCachePolicy(CachePolicy.DISABLED).diskCachePolicy(CachePolicy.DISABLED)
.data(file) .data(file)
.size(720, 1280) .size(720, 1280)
.target( .target(
@ -51,7 +51,7 @@ class SaveImageNotifier(private val context: Context) {
} }
} }
).build() ).build()
Coil.imageLoader(context).execute(request) Coil.imageLoader(context).enqueue(request)
} }
private fun showCompleteNotification(file: File, image: Bitmap) { private fun showCompleteNotification(file: File, image: Bitmap) {
@ -63,9 +63,7 @@ class SaveImageNotifier(private val context: Context) {
setAutoCancel(true) setAutoCancel(true)
color = ContextCompat.getColor(context, R.color.colorAccent) color = ContextCompat.getColor(context, R.color.colorAccent)
// Clear old actions if they exist // Clear old actions if they exist
if (mActions.isNotEmpty()) { clearActions()
mActions.clear()
}
setContentIntent(NotificationHandler.openImagePendingActivity(context, file)) setContentIntent(NotificationHandler.openImagePendingActivity(context, file))
// Share action // Share action

View File

@ -21,7 +21,7 @@ import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import androidx.core.net.toUri import androidx.core.net.toUri
import androidx.core.view.isVisible import androidx.core.view.isVisible
import coil.api.loadAny import coil.loadAny
import coil.request.CachePolicy import coil.request.CachePolicy
import com.davemorrissey.labs.subscaleview.ImageSource import com.davemorrissey.labs.subscaleview.ImageSource
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView

View File

@ -16,8 +16,8 @@ import androidx.appcompat.widget.AppCompatButton
import androidx.appcompat.widget.AppCompatImageView import androidx.appcompat.widget.AppCompatImageView
import androidx.core.net.toUri import androidx.core.net.toUri
import androidx.core.view.isVisible import androidx.core.view.isVisible
import coil.api.clear import coil.clear
import coil.api.loadAny import coil.loadAny
import coil.request.CachePolicy import coil.request.CachePolicy
import com.davemorrissey.labs.subscaleview.ImageSource import com.davemorrissey.labs.subscaleview.ImageSource
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView

View File

@ -5,8 +5,9 @@ import android.view.View
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import coil.Coil import coil.Coil
import coil.api.clear import coil.clear
import coil.request.LoadRequest import coil.imageLoader
import coil.request.ImageRequest
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
@ -60,10 +61,10 @@ class BrowseSourceGridHolder(
if (manga.thumbnail_url == null) { if (manga.thumbnail_url == null) {
binding.coverThumbnail.clear() binding.coverThumbnail.clear()
} else { } else {
val id = manga.id ?: return manga.id ?: return
val request = LoadRequest.Builder(view.context).data(manga) val request = ImageRequest.Builder(view.context).data(manga)
.target(CoverViewTarget(binding.coverThumbnail, binding.progress)).build() .target(CoverViewTarget(binding.coverThumbnail, binding.progress)).build()
Coil.imageLoader(view.context).execute(request) Coil.imageLoader(view.context).enqueue(request)
} }
} }
} }

View File

@ -3,8 +3,8 @@ package eu.kanade.tachiyomi.ui.source.browse
import android.view.View import android.view.View
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import coil.Coil import coil.Coil
import coil.api.clear import coil.clear
import coil.request.LoadRequest import coil.request.ImageRequest
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -49,9 +49,9 @@ class BrowseSourceListHolder(private val view: View, adapter: FlexibleAdapter<IF
binding.coverThumbnail.clear() binding.coverThumbnail.clear()
} else { } else {
manga.id ?: return manga.id ?: return
val request = LoadRequest.Builder(view.context).data(manga) val request = ImageRequest.Builder(view.context).data(manga)
.target(CoverViewTarget(binding.coverThumbnail)).build() .target(CoverViewTarget(binding.coverThumbnail)).build()
Coil.imageLoader(view.context).execute(request) Coil.imageLoader(view.context).enqueue(request)
} }
} }
} }

View File

@ -3,9 +3,9 @@ package eu.kanade.tachiyomi.ui.source.global_search
import android.view.View import android.view.View
import androidx.core.view.isVisible import androidx.core.view.isVisible
import coil.Coil import coil.Coil
import coil.api.clear import coil.clear
import coil.request.CachePolicy import coil.request.CachePolicy
import coil.request.LoadRequest import coil.request.ImageRequest
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.image.coil.CoverViewTarget import eu.kanade.tachiyomi.data.image.coil.CoverViewTarget
import eu.kanade.tachiyomi.databinding.SourceGlobalSearchControllerCardItemBinding import eu.kanade.tachiyomi.databinding.SourceGlobalSearchControllerCardItemBinding
@ -38,11 +38,11 @@ class GlobalSearchMangaHolder(view: View, adapter: GlobalSearchCardAdapter) :
fun setImage(manga: Manga) { fun setImage(manga: Manga) {
binding.itemImage.clear() binding.itemImage.clear()
if (!manga.thumbnail_url.isNullOrEmpty()) { if (!manga.thumbnail_url.isNullOrEmpty()) {
val request = LoadRequest.Builder(itemView.context).data(manga) val request = ImageRequest.Builder(itemView.context).data(manga)
.placeholder(android.R.color.transparent) .placeholder(android.R.color.transparent)
.memoryCachePolicy(CachePolicy.DISABLED) .memoryCachePolicy(CachePolicy.DISABLED)
.target(CoverViewTarget(binding.itemImage, binding.progress)).build() .target(CoverViewTarget(binding.itemImage, binding.progress)).build()
Coil.imageLoader(itemView.context).execute(request) Coil.imageLoader(itemView.context).enqueue(request)
} }
} }
} }

View File

@ -8,7 +8,7 @@ import android.graphics.Bitmap
import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Icon import android.graphics.drawable.Icon
import coil.Coil import coil.Coil
import coil.request.GetRequest import coil.request.ImageRequest
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.cache.CoverCache import eu.kanade.tachiyomi.data.cache.CoverCache
import eu.kanade.tachiyomi.data.database.DatabaseHelper import eu.kanade.tachiyomi.data.database.DatabaseHelper
@ -57,7 +57,7 @@ class MangaShortcutManager(
val shortcuts = recents.mapNotNull { item -> val shortcuts = recents.mapNotNull { item ->
when (item) { when (item) {
is Manga -> { is Manga -> {
val request = GetRequest.Builder(context).data(item).build() val request = ImageRequest.Builder(context).data(item).build()
val bitmap = ( val bitmap = (
Coil.imageLoader(context) Coil.imageLoader(context)
.execute(request).drawable as? BitmapDrawable .execute(request).drawable as? BitmapDrawable