From 8551379fd801193a0a0d35126764d528a2aeb9fe Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 18 Aug 2019 07:59:06 +0800 Subject: [PATCH] up --- .../java/io/legado/app/ui/bookinfo/ChapterListAdapter.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/io/legado/app/ui/bookinfo/ChapterListAdapter.kt b/app/src/main/java/io/legado/app/ui/bookinfo/ChapterListAdapter.kt index 5969d0b37..db2797eb2 100644 --- a/app/src/main/java/io/legado/app/ui/bookinfo/ChapterListAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/bookinfo/ChapterListAdapter.kt @@ -6,13 +6,21 @@ import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.data.entities.BookChapter import kotlinx.android.synthetic.main.item_chapter_list.view.* +import org.jetbrains.anko.sdk27.listeners.onClick class ChapterListAdapter(context: Context) : SimpleRecyclerAdapter(context, R.layout.item_chapter_list) { + var callBack: CallBack? = null override fun convert(holder: ItemViewHolder, item: BookChapter, payloads: MutableList) { holder.itemView.apply { tv_chapter_name.text = item.title + this.onClick { + callBack?.skipToChapter(item.index) + } } } + interface CallBack { + fun skipToChapter(index: Int) + } } \ No newline at end of file