pull/78/head
kunfei 5 years ago
parent b7023fd4f8
commit 0183a9f437
  1. 2
      app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfAdapter.kt
  2. 5
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt

@ -15,7 +15,7 @@ class BookshelfAdapter(fragment: Fragment, val callBack: CallBack) :
override fun createFragment(position: Int): Fragment { override fun createFragment(position: Int): Fragment {
val groupId = callBack.getGroup(position).groupId val groupId = callBack.getGroup(position).groupId
return BooksFragment.newInstance(groupId) return BooksFragment.newInstance(position, groupId)
} }
interface CallBack { interface CallBack {

@ -32,10 +32,11 @@ class BooksFragment : BaseFragment(R.layout.fragment_books),
BooksAdapter.CallBack { BooksAdapter.CallBack {
companion object { companion object {
fun newInstance(position: Int): BooksFragment { fun newInstance(position: Int, groupId: Int): BooksFragment {
return BooksFragment().apply { return BooksFragment().apply {
val bundle = Bundle() val bundle = Bundle()
bundle.putInt("groupId", position) bundle.putInt("position", position)
bundle.putInt("groupId", groupId)
arguments = bundle arguments = bundle
} }
} }

Loading…
Cancel
Save