feat: 修复bug

pull/238/head
gedoor 5 years ago
parent fcf8028a59
commit 68aa9ab82c
  1. 24
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt

@ -2,6 +2,7 @@ package io.legado.app.ui.main.bookshelf.books
import android.content.Context
import android.os.Bundle
import android.view.View
import io.legado.app.R
import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.constant.BookType
@ -25,14 +26,7 @@ class BooksAdapterList(context: Context, private val callBack: CallBack) :
tv_read.text = item.durChapterTitle
tv_last.text = item.latestChapterTitle
iv_cover.load(item.getDisplayCover(), item.name, item.author)
if (item.origin != BookType.local && callBack.isUpdate(item.bookUrl)) {
bv_unread.invisible()
rl_loading.show()
} else {
rl_loading.hide()
bv_unread.setBadgeCount(item.getUnreadChapterNum())
bv_unread.setHighlight(item.lastCheckCount > 0)
}
upRefresh(this, item)
} else {
bundle.keySet().map {
when (it) {
@ -41,7 +35,15 @@ class BooksAdapterList(context: Context, private val callBack: CallBack) :
"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)) {
"refresh" -> upRefresh(this, item)
}
}
}
}
}
private fun upRefresh(itemView: View, item: Book) = with(itemView) {
if (item.origin != BookType.local && callBack.isUpdate(item.bookUrl)) {
bv_unread.invisible()
rl_loading.show()
} else {
@ -50,10 +52,6 @@ class BooksAdapterList(context: Context, private val callBack: CallBack) :
bv_unread.setHighlight(item.lastCheckCount > 0)
}
}
}
}
}
}
override fun registerListener(holder: ItemViewHolder) {
holder.itemView.apply {

Loading…
Cancel
Save