pull/35/head
kunfei 5 years ago
parent 9414f5e82a
commit cf88899eb0
  1. 5
      app/src/main/java/io/legado/app/ui/main/bookshelf/BookGroupAdapter.kt
  2. 7
      app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt

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

@ -94,11 +94,8 @@ class BookshelfFragment : VMBaseFragment<BookshelfViewModel>(R.layout.fragment_b
})
}
override fun open(bookGroup: BookGroup) {
when (bookGroup.groupId) {
-10 -> showGroupInputDialog()
else -> context
}
override fun onClickGroup(position: Int) {
view_pager_bookshelf.setCurrentItem(position, false)
}
override fun onQueryTextSubmit(query: String?): Boolean {

Loading…
Cancel
Save