pull/274/head
gedoor 4 years ago
parent dfe5bc4cf5
commit f566e26261
  1. 2
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt
  2. 2
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt
  3. 19
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksDiffCallBack.kt

@ -25,7 +25,7 @@ class BooksAdapterGrid(context: Context, private val callBack: CallBack) :
iv_cover.load(item.getDisplayCover(), item.name, item.author) iv_cover.load(item.getDisplayCover(), item.name, item.author)
upRefresh(this, item) upRefresh(this, item)
} else { } else {
bundle.keySet().map { bundle.keySet().forEach {
when (it) { when (it) {
"name" -> tv_name.text = item.name "name" -> tv_name.text = item.name
"cover" -> iv_cover.load(item.getDisplayCover(), item.name, item.author) "cover" -> iv_cover.load(item.getDisplayCover(), item.name, item.author)

@ -28,7 +28,7 @@ class BooksAdapterList(context: Context, private val callBack: CallBack) :
iv_cover.load(item.getDisplayCover(), item.name, item.author) iv_cover.load(item.getDisplayCover(), item.name, item.author)
upRefresh(this, item) upRefresh(this, item)
} else { } else {
bundle.keySet().map { bundle.keySet().forEach {
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

@ -42,11 +42,20 @@ 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", null) if (oldItem.name != newItem.name) bundle.putString("name", newItem.name)
if (oldItem.author != newItem.author) bundle.putString("author", null) if (oldItem.author != newItem.author) bundle.putString("author", newItem.author)
if (oldItem.durChapterTitle != newItem.durChapterTitle) bundle.putString("dur", null) if (oldItem.durChapterTitle != newItem.durChapterTitle) bundle.putString(
if (oldItem.latestChapterTitle != newItem.latestChapterTitle) bundle.putString("last", null) "dur",
if (oldItem.getDisplayCover() != newItem.getDisplayCover()) bundle.putString("cover", null) newItem.durChapterTitle
)
if (oldItem.latestChapterTitle != newItem.latestChapterTitle) bundle.putString(
"last",
newItem.latestChapterTitle
)
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