|
|
@ -3,9 +3,8 @@ package io.legado.app.ui.book.search |
|
|
|
import android.content.Context |
|
|
|
import android.content.Context |
|
|
|
import android.os.Bundle |
|
|
|
import android.os.Bundle |
|
|
|
import android.view.ViewGroup |
|
|
|
import android.view.ViewGroup |
|
|
|
import androidx.recyclerview.widget.DiffUtil |
|
|
|
|
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.base.adapter.DiffRecyclerAdapter |
|
|
|
import io.legado.app.base.adapter.CommonRecyclerAdapter |
|
|
|
import io.legado.app.base.adapter.ItemViewHolder |
|
|
|
import io.legado.app.base.adapter.ItemViewHolder |
|
|
|
import io.legado.app.data.entities.SearchBook |
|
|
|
import io.legado.app.data.entities.SearchBook |
|
|
|
import io.legado.app.databinding.ItemSearchBinding |
|
|
|
import io.legado.app.databinding.ItemSearchBinding |
|
|
@ -14,19 +13,7 @@ import io.legado.app.utils.visible |
|
|
|
import org.jetbrains.anko.sdk27.listeners.onClick |
|
|
|
import org.jetbrains.anko.sdk27.listeners.onClick |
|
|
|
|
|
|
|
|
|
|
|
class SearchAdapter(context: Context, val callBack: CallBack) : |
|
|
|
class SearchAdapter(context: Context, val callBack: CallBack) : |
|
|
|
DiffRecyclerAdapter<SearchBook, ItemSearchBinding>(context) { |
|
|
|
CommonRecyclerAdapter<SearchBook, ItemSearchBinding>(context) { |
|
|
|
|
|
|
|
|
|
|
|
override val diffItemCallback: DiffUtil.ItemCallback<SearchBook> |
|
|
|
|
|
|
|
get() = object : DiffUtil.ItemCallback<SearchBook>() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun areContentsTheSame(oldItem: SearchBook, newItem: SearchBook): Boolean { |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun areItemsTheSame(oldItem: SearchBook, newItem: SearchBook): Boolean { |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun getViewBinding(parent: ViewGroup): ItemSearchBinding { |
|
|
|
override fun getViewBinding(parent: ViewGroup): ItemSearchBinding { |
|
|
|
return ItemSearchBinding.inflate(inflater, parent, false) |
|
|
|
return ItemSearchBinding.inflate(inflater, parent, false) |
|
|
|