|
|
@ -7,7 +7,8 @@ import io.legado.app.base.adapter.ItemViewHolder |
|
|
|
import io.legado.app.constant.BookType |
|
|
|
import io.legado.app.constant.BookType |
|
|
|
import io.legado.app.data.entities.Book |
|
|
|
import io.legado.app.data.entities.Book |
|
|
|
import io.legado.app.databinding.ItemBookshelfListBinding |
|
|
|
import io.legado.app.databinding.ItemBookshelfListBinding |
|
|
|
import io.legado.app.lib.theme.ATH |
|
|
|
import io.legado.app.lib.theme.backgroundColor |
|
|
|
|
|
|
|
import io.legado.app.utils.ColorUtils |
|
|
|
import io.legado.app.utils.invisible |
|
|
|
import io.legado.app.utils.invisible |
|
|
|
import splitties.views.onLongClick |
|
|
|
import splitties.views.onLongClick |
|
|
|
|
|
|
|
|
|
|
@ -23,24 +24,24 @@ class BooksAdapterList(context: Context, private val callBack: CallBack) : |
|
|
|
binding: ItemBookshelfListBinding, |
|
|
|
binding: ItemBookshelfListBinding, |
|
|
|
item: Book, |
|
|
|
item: Book, |
|
|
|
payloads: MutableList<Any> |
|
|
|
payloads: MutableList<Any> |
|
|
|
) { |
|
|
|
) = with(binding) { |
|
|
|
val bundle = payloads.getOrNull(0) as? Bundle |
|
|
|
val bundle = payloads.getOrNull(0) as? Bundle |
|
|
|
if (bundle == null) { |
|
|
|
if (bundle == null) { |
|
|
|
ATH.applyBackgroundTint(binding.root) |
|
|
|
root.setBackgroundColor(ColorUtils.withAlpha(context.backgroundColor, 0.5f)) |
|
|
|
binding.tvName.text = item.name |
|
|
|
tvName.text = item.name |
|
|
|
binding.tvAuthor.text = item.author |
|
|
|
tvAuthor.text = item.author |
|
|
|
binding.tvRead.text = item.durChapterTitle |
|
|
|
tvRead.text = item.durChapterTitle |
|
|
|
binding.tvLast.text = item.latestChapterTitle |
|
|
|
tvLast.text = item.latestChapterTitle |
|
|
|
binding.ivCover.load(item.getDisplayCover(), item.name, item.author) |
|
|
|
ivCover.load(item.getDisplayCover(), item.name, item.author) |
|
|
|
upRefresh(binding, item) |
|
|
|
upRefresh(binding, item) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
binding.tvRead.text = item.durChapterTitle |
|
|
|
tvRead.text = item.durChapterTitle |
|
|
|
binding.tvLast.text = item.latestChapterTitle |
|
|
|
tvLast.text = item.latestChapterTitle |
|
|
|
bundle.keySet().forEach { |
|
|
|
bundle.keySet().forEach { |
|
|
|
when (it) { |
|
|
|
when (it) { |
|
|
|
"name" -> binding.tvName.text = item.name |
|
|
|
"name" -> tvName.text = item.name |
|
|
|
"author" -> binding.tvAuthor.text = item.author |
|
|
|
"author" -> tvAuthor.text = item.author |
|
|
|
"cover" -> binding.ivCover.load(item.getDisplayCover(), item.name, item.author) |
|
|
|
"cover" -> ivCover.load(item.getDisplayCover(), item.name, item.author) |
|
|
|
"refresh" -> upRefresh(binding, item) |
|
|
|
"refresh" -> upRefresh(binding, item) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|