pull/293/head 3.20.080221
gedoor 4 years ago
parent 3a9f9ee11e
commit a947fd60be
  1. 6
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt
  2. 29
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksDiffCallBack.kt

@ -32,10 +32,12 @@ class BooksAdapterList(context: Context, private val callBack: CallBack) :
when (it) { when (it) {
"name" -> tv_name.text = item.name "name" -> tv_name.text = item.name
"author" -> tv_author.text = item.author "author" -> tv_author.text = item.author
"dur" -> tv_read.text = item.durChapterTitle
"last" -> tv_last.text = item.latestChapterTitle
"cover" -> iv_cover.load(item.getDisplayCover(), item.name, item.author) "cover" -> iv_cover.load(item.getDisplayCover(), item.name, item.author)
"refresh" -> upRefresh(this, item) "refresh" -> upRefresh(this, item)
else -> {
tv_read.text = item.durChapterTitle
tv_last.text = item.latestChapterTitle
}
} }
} }
} }

@ -42,20 +42,21 @@ class BooksDiffCallBack(private val oldItems: List<Book>, private val newItems:
val oldItem = oldItems[oldItemPosition] val oldItem = oldItems[oldItemPosition]
val newItem = newItems[newItemPosition] val newItem = newItems[newItemPosition]
val bundle = bundleOf() val bundle = bundleOf()
if (oldItem.name != newItem.name) bundle.putString("name", newItem.name) if (oldItem.name != newItem.name) {
if (oldItem.author != newItem.author) bundle.putString("author", newItem.author) bundle.putString("name", newItem.name)
if (oldItem.durChapterTitle != newItem.durChapterTitle) bundle.putString( }
"dur", if (oldItem.author != newItem.author) {
newItem.durChapterTitle bundle.putString("author", newItem.author)
) }
if (oldItem.latestChapterTitle != newItem.latestChapterTitle) bundle.putString( if (oldItem.durChapterTitle != newItem.durChapterTitle) {
"last", bundle.putString("dur", newItem.durChapterTitle)
newItem.latestChapterTitle }
) if (oldItem.latestChapterTitle != newItem.latestChapterTitle) {
if (oldItem.getDisplayCover() != newItem.getDisplayCover()) bundle.putString( bundle.putString("last", newItem.latestChapterTitle)
"cover", }
newItem.getDisplayCover() if (oldItem.getDisplayCover() != newItem.getDisplayCover()) {
) bundle.putString("cover", newItem.getDisplayCover())
}
if (oldItem.lastCheckCount != newItem.lastCheckCount if (oldItem.lastCheckCount != newItem.lastCheckCount
|| oldItem.durChapterTime != newItem.durChapterTime || oldItem.durChapterTime != newItem.durChapterTime
|| oldItem.getUnreadChapterNum() != newItem.getUnreadChapterNum() || oldItem.getUnreadChapterNum() != newItem.getUnreadChapterNum()

Loading…
Cancel
Save