Optimize image loading in lists

This commit is contained in:
Koitharu
2022-07-13 11:24:20 +03:00
parent 2595c11686
commit 0e1b5b19d2
16 changed files with 157 additions and 206 deletions

View File

@@ -27,13 +27,14 @@ fun downloadItemAD(
bind {
job?.cancel()
job = item.progressAsFlow().onFirst { state ->
binding.imageViewCover.newImageRequest(state.manga.coverUrl)
.referer(state.manga.publicUrl)
.placeholder(state.cover)
.fallback(R.drawable.ic_placeholder)
.error(R.drawable.ic_placeholder)
.allowRgb565(isLowRamDevice(context))
.enqueueWith(coil)
binding.imageViewCover.newImageRequest(state.manga.coverUrl)?.run {
referer(state.manga.publicUrl)
placeholder(state.cover)
fallback(R.drawable.ic_placeholder)
error(R.drawable.ic_placeholder)
allowRgb565(true)
enqueueWith(coil)
}
}.onEach { state ->
binding.textViewTitle.text = state.manga.title
when (state) {