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