From 7f128b83653b9f090ccd212d8705ad62317866b7 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 12 Feb 2020 19:00:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/chapterlist/ChapterListAdapter.kt | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListAdapter.kt b/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListAdapter.kt index 05b70e1d3..53d1f6d86 100644 --- a/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListAdapter.kt @@ -6,7 +6,6 @@ import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter -import io.legado.app.help.BookHelp import io.legado.app.lib.theme.accentColor import io.legado.app.utils.getCompatColor import io.legado.app.utils.visible @@ -19,21 +18,23 @@ class ChapterListAdapter(context: Context, val callback: Callback) : override fun convert(holder: ItemViewHolder, item: BookChapter, payloads: MutableList) { with(holder.itemView) { - if (callback.durChapterIndex() == item.index) { - tv_chapter_name.setTextColor(context.accentColor) + if (payloads.isEmpty()) { + if (callback.durChapterIndex() == item.index) { + tv_chapter_name.setTextColor(context.accentColor) + } else { + tv_chapter_name.setTextColor(context.getCompatColor(R.color.tv_text_default)) + } + tv_chapter_name.text = item.title + if (!item.tag.isNullOrEmpty()) { + tv_tag.text = item.tag + tv_tag.visible() + } + this.onClick { + callback.openChapter(item) + } } else { - tv_chapter_name.setTextColor(context.getCompatColor(R.color.tv_text_default)) - } - tv_chapter_name.text = item.title - if (!item.tag.isNullOrEmpty()) { - tv_tag.text = item.tag - tv_tag.visible() - } - this.onClick { - callback.openChapter(item) - } - callback.book()?.let { - tv_chapter_name.paint.isFakeBoldText = BookHelp.hasContent(it, item) + val hasContent = payloads[0] as Boolean + tv_chapter_name.paint.isFakeBoldText = hasContent } } }