|
|
@ -6,7 +6,6 @@ import io.legado.app.base.adapter.ItemViewHolder |
|
|
|
import io.legado.app.base.adapter.SimpleRecyclerAdapter |
|
|
|
import io.legado.app.base.adapter.SimpleRecyclerAdapter |
|
|
|
import io.legado.app.data.entities.Book |
|
|
|
import io.legado.app.data.entities.Book |
|
|
|
import io.legado.app.data.entities.BookChapter |
|
|
|
import io.legado.app.data.entities.BookChapter |
|
|
|
import io.legado.app.help.BookHelp |
|
|
|
|
|
|
|
import io.legado.app.lib.theme.accentColor |
|
|
|
import io.legado.app.lib.theme.accentColor |
|
|
|
import io.legado.app.utils.getCompatColor |
|
|
|
import io.legado.app.utils.getCompatColor |
|
|
|
import io.legado.app.utils.visible |
|
|
|
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>) { |
|
|
|
override fun convert(holder: ItemViewHolder, item: BookChapter, payloads: MutableList<Any>) { |
|
|
|
with(holder.itemView) { |
|
|
|
with(holder.itemView) { |
|
|
|
if (callback.durChapterIndex() == item.index) { |
|
|
|
if (payloads.isEmpty()) { |
|
|
|
tv_chapter_name.setTextColor(context.accentColor) |
|
|
|
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 { |
|
|
|
} else { |
|
|
|
tv_chapter_name.setTextColor(context.getCompatColor(R.color.tv_text_default)) |
|
|
|
val hasContent = payloads[0] as Boolean |
|
|
|
} |
|
|
|
tv_chapter_name.paint.isFakeBoldText = hasContent |
|
|
|
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) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|