feat: 优化代码

pull/103/head
kunfei 5 years ago
parent 87481f12a1
commit 6d4fcd0f18
  1. 4
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt
  2. 6
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksDiffCallBack.kt

@ -38,8 +38,8 @@ class BooksAdapterList(context: Context, private val callBack: CallBack) :
when (it) {
"name" -> tv_name.text = item.name
"author" -> tv_author.text = item.author
"durTitle" -> tv_read.text = item.durChapterTitle
"latestTitle" -> tv_last.text = item.latestChapterTitle
"dur" -> tv_read.text = item.durChapterTitle
"last" -> tv_last.text = item.latestChapterTitle
"cover" -> iv_cover.load(item.getDisplayCover(), item.name, item.author)
"refresh" -> if (item.origin != BookType.local && callBack.isUpdate(item.bookUrl)) {
bv_unread.invisible()

@ -48,11 +48,13 @@ class BooksDiffCallBack(private val oldItems: List<Book>, private val newItems:
if (oldItem.author != newItem.author)
bundle.putString("author", null)
if (oldItem.durChapterTitle != newItem.durChapterTitle)
bundle.putString("durTitle", null)
bundle.putString("dur", null)
if (oldItem.latestChapterTitle != newItem.latestChapterTitle)
bundle.putString("latestTitle", null)
bundle.putString("last", null)
if (oldItem.getDisplayCover() != newItem.getDisplayCover())
bundle.putString("cover", null)
if (oldItem.lastCheckCount != newItem.lastCheckCount)
bundle.putString("refresh", null)
if (oldItem.getUnreadChapterNum() != newItem.getUnreadChapterNum()
|| oldItem.lastCheckCount != newItem.lastCheckCount
) {

Loading…
Cancel
Save