|
|
@ -44,14 +44,12 @@ class ChapterListAdapter(val callback: Callback) : |
|
|
|
class MyViewHolder(view: View) : RecyclerView.ViewHolder(view) { |
|
|
|
class MyViewHolder(view: View) : RecyclerView.ViewHolder(view) { |
|
|
|
|
|
|
|
|
|
|
|
fun bind(bookChapter: BookChapter, callback: Callback) = with(itemView) { |
|
|
|
fun bind(bookChapter: BookChapter, callback: Callback) = with(itemView) { |
|
|
|
tv_chapter_name.text = bookChapter.title |
|
|
|
if (callback.durChapterIndex() == bookChapter.index) { |
|
|
|
callback.let { |
|
|
|
tv_chapter_name.setTextColor(context.accentColor) |
|
|
|
if (it.durChapterIndex() == bookChapter.index) { |
|
|
|
} else { |
|
|
|
tv_chapter_name.setTextColor(context.accentColor) |
|
|
|
tv_chapter_name.setTextColor(context.getCompatColor(R.color.tv_text_default)) |
|
|
|
} else { |
|
|
|
|
|
|
|
tv_chapter_name.setTextColor(context.getCompatColor(R.color.tv_text_default)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
tv_chapter_name.text = bookChapter.title |
|
|
|
itemView.onClick { |
|
|
|
itemView.onClick { |
|
|
|
callback.openChapter(bookChapter) |
|
|
|
callback.openChapter(bookChapter) |
|
|
|
} |
|
|
|
} |
|
|
|