|
|
@ -6,6 +6,7 @@ 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.BookGroup |
|
|
|
import io.legado.app.data.entities.BookGroup |
|
|
|
import kotlinx.android.synthetic.main.item_book_group.view.* |
|
|
|
import kotlinx.android.synthetic.main.item_book_group.view.* |
|
|
|
|
|
|
|
import org.jetbrains.anko.sdk27.listeners.onClick |
|
|
|
|
|
|
|
|
|
|
|
class BookGroupAdapter(context: Context, val callBack: CallBack) : |
|
|
|
class BookGroupAdapter(context: Context, val callBack: CallBack) : |
|
|
|
SimpleRecyclerAdapter<BookGroup>(context, R.layout.item_book_group) { |
|
|
|
SimpleRecyclerAdapter<BookGroup>(context, R.layout.item_book_group) { |
|
|
@ -13,11 +14,11 @@ class BookGroupAdapter(context: Context, val callBack: CallBack) : |
|
|
|
override fun convert(holder: ItemViewHolder, item: BookGroup, payloads: MutableList<Any>) { |
|
|
|
override fun convert(holder: ItemViewHolder, item: BookGroup, payloads: MutableList<Any>) { |
|
|
|
with(holder.itemView) { |
|
|
|
with(holder.itemView) { |
|
|
|
tv_group.text = item.groupName |
|
|
|
tv_group.text = item.groupName |
|
|
|
tv_group.setOnClickListener { callBack.open(item) } |
|
|
|
tv_group.onClick { callBack.onClickGroup(holder.layoutPosition) } |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
interface CallBack { |
|
|
|
interface CallBack { |
|
|
|
fun open(bookGroup: BookGroup) |
|
|
|
fun onClickGroup(position: Int) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |