pull/32/head
gedoor 6 years ago
parent 6e9ee62137
commit 9ac33c517f
  1. 11
      app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfAdapter.kt

@ -9,7 +9,6 @@ import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.request.RequestOptions
import io.legado.app.R import io.legado.app.R
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
import io.legado.app.lib.theme.ThemeStore import io.legado.app.lib.theme.ThemeStore
@ -59,13 +58,15 @@ class BookshelfAdapter : PagedListAdapter<Book, BookshelfAdapter.MyViewHolder>(D
cover?.let { cover?.let {
if (it.startsWith("http")) { if (it.startsWith("http")) {
Glide.with(itemView).load(it) Glide.with(itemView).load(it)
.apply(RequestOptions().dontAnimate().diskCacheStrategy(DiskCacheStrategy.RESOURCE) .placeholder(R.drawable.img_cover_default)
.centerCrop().placeholder(R.drawable.img_cover_default)) .centerCrop()
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.into(iv_cover) .into(iv_cover)
} else { } else {
Glide.with(itemView).load(File(it)) Glide.with(itemView).load(File(it))
.apply(RequestOptions().dontAnimate().diskCacheStrategy(DiskCacheStrategy.RESOURCE) .placeholder(R.drawable.img_cover_default)
.centerCrop().placeholder(R.drawable.img_cover_default)) .centerCrop()
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.into(iv_cover) .into(iv_cover)
} }
} }

Loading…
Cancel
Save