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