|
|
@ -2,6 +2,7 @@ package io.legado.app.ui.book.changecover |
|
|
|
|
|
|
|
|
|
|
|
import android.content.Context |
|
|
|
import android.content.Context |
|
|
|
import android.view.ViewGroup |
|
|
|
import android.view.ViewGroup |
|
|
|
|
|
|
|
import androidx.recyclerview.widget.DiffUtil |
|
|
|
import io.legado.app.base.adapter.ItemViewHolder |
|
|
|
import io.legado.app.base.adapter.ItemViewHolder |
|
|
|
import io.legado.app.base.adapter.SimpleRecyclerAdapter |
|
|
|
import io.legado.app.base.adapter.SimpleRecyclerAdapter |
|
|
|
import io.legado.app.data.entities.SearchBook |
|
|
|
import io.legado.app.data.entities.SearchBook |
|
|
@ -11,6 +12,19 @@ import org.jetbrains.anko.sdk27.listeners.onClick |
|
|
|
class CoverAdapter(context: Context, val callBack: CallBack) : |
|
|
|
class CoverAdapter(context: Context, val callBack: CallBack) : |
|
|
|
SimpleRecyclerAdapter<SearchBook, ItemCoverBinding>(context) { |
|
|
|
SimpleRecyclerAdapter<SearchBook, ItemCoverBinding>(context) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override val diffItemCallback: DiffUtil.ItemCallback<SearchBook> |
|
|
|
|
|
|
|
get() = object : DiffUtil.ItemCallback<SearchBook>() { |
|
|
|
|
|
|
|
override fun areItemsTheSame(oldItem: SearchBook, newItem: SearchBook): Boolean { |
|
|
|
|
|
|
|
return oldItem.bookUrl == newItem.bookUrl |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun areContentsTheSame(oldItem: SearchBook, newItem: SearchBook): Boolean { |
|
|
|
|
|
|
|
return oldItem.originName == newItem.originName |
|
|
|
|
|
|
|
&& oldItem.coverUrl == newItem.coverUrl |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun getViewBinding(parent: ViewGroup): ItemCoverBinding { |
|
|
|
override fun getViewBinding(parent: ViewGroup): ItemCoverBinding { |
|
|
|
return ItemCoverBinding.inflate(inflater, parent, false) |
|
|
|
return ItemCoverBinding.inflate(inflater, parent, false) |
|
|
|
} |
|
|
|
} |
|
|
|