|
|
|
@ -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<Any>) { |
|
|
|
|
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 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|