|
|
@ -17,49 +17,50 @@ class BooksAdapter(context: Context, private val callBack: CallBack) : |
|
|
|
SimpleRecyclerAdapter<Book>(context, R.layout.item_bookshelf_list) { |
|
|
|
SimpleRecyclerAdapter<Book>(context, R.layout.item_bookshelf_list) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun convert(holder: ItemViewHolder, item: Book, payloads: MutableList<Any>) = |
|
|
|
override fun convert(holder: ItemViewHolder, item: Book, payloads: MutableList<Any>) { |
|
|
|
with(holder.itemView) { |
|
|
|
with(holder.itemView) { |
|
|
|
if (payloads.isEmpty()) { |
|
|
|
if (payloads.isEmpty()) { |
|
|
|
ATH.applyBackgroundTint(this) |
|
|
|
ATH.applyBackgroundTint(this) |
|
|
|
tv_name.text = item.name |
|
|
|
tv_name.text = item.name |
|
|
|
tv_author.text = item.author |
|
|
|
tv_author.text = item.author |
|
|
|
tv_read.text = item.durChapterTitle |
|
|
|
tv_read.text = item.durChapterTitle |
|
|
|
tv_last.text = item.latestChapterTitle |
|
|
|
tv_last.text = item.latestChapterTitle |
|
|
|
item.getDisplayCover()?.let { |
|
|
|
item.getDisplayCover()?.let { |
|
|
|
ImageLoader.load(context, it)//Glide自动识别http://和file:// |
|
|
|
ImageLoader.load(context, it)//Glide自动识别http://和file:// |
|
|
|
.placeholder(R.drawable.image_cover_default) |
|
|
|
.placeholder(R.drawable.image_cover_default) |
|
|
|
.error(R.drawable.image_cover_default) |
|
|
|
.error(R.drawable.image_cover_default) |
|
|
|
.centerCrop() |
|
|
|
.centerCrop() |
|
|
|
.setAsDrawable(iv_cover) |
|
|
|
.setAsDrawable(iv_cover) |
|
|
|
} |
|
|
|
} |
|
|
|
onClick { callBack.open(item) } |
|
|
|
onClick { callBack.open(item) } |
|
|
|
onLongClick { |
|
|
|
onLongClick { |
|
|
|
callBack.openBookInfo(item) |
|
|
|
callBack.openBookInfo(item) |
|
|
|
true |
|
|
|
true |
|
|
|
} |
|
|
|
} |
|
|
|
if (item.origin != BookType.local && callBack.isUpdate(item.bookUrl)) { |
|
|
|
if (item.origin != BookType.local && callBack.isUpdate(item.bookUrl)) { |
|
|
|
bv_unread.invisible() |
|
|
|
bv_unread.invisible() |
|
|
|
rl_loading.show() |
|
|
|
rl_loading.show() |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
rl_loading.hide() |
|
|
|
|
|
|
|
bv_unread.setBadgeCount(item.getUnreadChapterNum()) |
|
|
|
|
|
|
|
bv_unread.setHighlight(item.lastCheckCount > 0) |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
rl_loading.hide() |
|
|
|
when (payloads[0]) { |
|
|
|
bv_unread.setBadgeCount(item.getUnreadChapterNum()) |
|
|
|
5 -> { |
|
|
|
bv_unread.setHighlight(item.lastCheckCount > 0) |
|
|
|
if (item.origin != BookType.local && callBack.isUpdate(item.bookUrl)) { |
|
|
|
} |
|
|
|
bv_unread.invisible() |
|
|
|
} else { |
|
|
|
rl_loading.show() |
|
|
|
when (payloads[0]) { |
|
|
|
} else { |
|
|
|
5 -> { |
|
|
|
rl_loading.hide() |
|
|
|
if (item.origin != BookType.local && callBack.isUpdate(item.bookUrl)) { |
|
|
|
bv_unread.setBadgeCount(item.getUnreadChapterNum()) |
|
|
|
bv_unread.invisible() |
|
|
|
bv_unread.setHighlight(item.lastCheckCount > 0) |
|
|
|
rl_loading.show() |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
rl_loading.hide() |
|
|
|
|
|
|
|
bv_unread.setBadgeCount(item.getUnreadChapterNum()) |
|
|
|
|
|
|
|
bv_unread.setHighlight(item.lastCheckCount > 0) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun notification(bookUrl: String) { |
|
|
|
fun notification(bookUrl: String) { |
|
|
|
for (i in 0 until itemCount) { |
|
|
|
for (i in 0 until itemCount) { |
|
|
|