pull/32/head
kunfei 5 years ago
parent 2a93dc2ba3
commit 8551379fd8
  1. 8
      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.base.adapter.SimpleRecyclerAdapter
import io.legado.app.data.entities.BookChapter import io.legado.app.data.entities.BookChapter
import kotlinx.android.synthetic.main.item_chapter_list.view.* import kotlinx.android.synthetic.main.item_chapter_list.view.*
import org.jetbrains.anko.sdk27.listeners.onClick
class ChapterListAdapter(context: Context) : SimpleRecyclerAdapter<BookChapter>(context, R.layout.item_chapter_list) { class ChapterListAdapter(context: Context) : SimpleRecyclerAdapter<BookChapter>(context, R.layout.item_chapter_list) {
var callBack: CallBack? = null
override fun convert(holder: ItemViewHolder, item: BookChapter, payloads: MutableList<Any>) { override fun convert(holder: ItemViewHolder, item: BookChapter, payloads: MutableList<Any>) {
holder.itemView.apply { holder.itemView.apply {
tv_chapter_name.text = item.title tv_chapter_name.text = item.title
this.onClick {
callBack?.skipToChapter(item.index)
}
} }
} }
interface CallBack {
fun skipToChapter(index: Int)
}
} }
Loading…
Cancel
Save