diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt index be725abe9..7967b3843 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt @@ -25,7 +25,7 @@ class BooksAdapterGrid(context: Context, private val callBack: CallBack) : iv_cover.load(item.getDisplayCover(), item.name, item.author) upRefresh(this, item) } else { - bundle.keySet().map { + bundle.keySet().forEach { when (it) { "name" -> tv_name.text = item.name "cover" -> iv_cover.load(item.getDisplayCover(), item.name, item.author) diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt index 7ed9a7d99..452ebe59e 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt @@ -28,7 +28,7 @@ class BooksAdapterList(context: Context, private val callBack: CallBack) : iv_cover.load(item.getDisplayCover(), item.name, item.author) upRefresh(this, item) } else { - bundle.keySet().map { + bundle.keySet().forEach { when (it) { "name" -> tv_name.text = item.name "author" -> tv_author.text = item.author diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksDiffCallBack.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksDiffCallBack.kt index 0756daca5..f66c6480f 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksDiffCallBack.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksDiffCallBack.kt @@ -42,11 +42,20 @@ class BooksDiffCallBack(private val oldItems: List, private val newItems: val oldItem = oldItems[oldItemPosition] val newItem = newItems[newItemPosition] val bundle = bundleOf() - if (oldItem.name != newItem.name) bundle.putString("name", null) - if (oldItem.author != newItem.author) bundle.putString("author", null) - if (oldItem.durChapterTitle != newItem.durChapterTitle) bundle.putString("dur", null) - if (oldItem.latestChapterTitle != newItem.latestChapterTitle) bundle.putString("last", null) - if (oldItem.getDisplayCover() != newItem.getDisplayCover()) bundle.putString("cover", null) + if (oldItem.name != newItem.name) bundle.putString("name", newItem.name) + if (oldItem.author != newItem.author) bundle.putString("author", newItem.author) + if (oldItem.durChapterTitle != newItem.durChapterTitle) bundle.putString( + "dur", + 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 || oldItem.durChapterTime != newItem.durChapterTime || oldItem.getUnreadChapterNum() != newItem.getUnreadChapterNum()