From a947fd60be1a14b494248cba04404a65779adf2f Mon Sep 17 00:00:00 2001 From: gedoor Date: Mon, 3 Aug 2020 17:24:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/bookshelf/books/BooksAdapterList.kt | 6 ++-- .../main/bookshelf/books/BooksDiffCallBack.kt | 29 ++++++++++--------- 2 files changed, 19 insertions(+), 16 deletions(-) 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 452ebe59e..a91bf4e53 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 @@ -32,10 +32,12 @@ class BooksAdapterList(context: Context, private val callBack: CallBack) : when (it) { "name" -> tv_name.text = item.name "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) "refresh" -> upRefresh(this, item) + else -> { + tv_read.text = item.durChapterTitle + tv_last.text = item.latestChapterTitle + } } } } 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 7b3253334..8498b77a3 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,20 +42,21 @@ 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", 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.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()