pull/78/head
kunfei 5 years ago
parent 1a6f55bc15
commit bd7b136e8e
  1. 2
      app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt

@ -93,6 +93,7 @@ class BookshelfFragment : VMBaseFragment<BookshelfViewModel>(R.layout.fragment_b
bookGroupLiveData = App.db.bookGroupDao().liveDataAll() bookGroupLiveData = App.db.bookGroupDao().liveDataAll()
bookGroupLiveData?.observe(viewLifecycleOwner, Observer { bookGroupLiveData?.observe(viewLifecycleOwner, Observer {
synchronized(this) { synchronized(this) {
tab_layout.removeOnTabSelectedListener(this)
bookGroups.clear() bookGroups.clear()
bookGroups.add(AppConst.bookGroupAll) bookGroups.add(AppConst.bookGroupAll)
if (AppConst.bookGroupLocalShow) { if (AppConst.bookGroupLocalShow) {
@ -104,7 +105,6 @@ class BookshelfFragment : VMBaseFragment<BookshelfViewModel>(R.layout.fragment_b
bookGroups.addAll(it) bookGroups.addAll(it)
view_pager_bookshelf.adapter?.notifyDataSetChanged() view_pager_bookshelf.adapter?.notifyDataSetChanged()
tab_layout.getTabAt(getPrefInt(PreferKey.saveTabPosition, 0))?.select() tab_layout.getTabAt(getPrefInt(PreferKey.saveTabPosition, 0))?.select()
tab_layout.removeOnTabSelectedListener(this)
tab_layout.addOnTabSelectedListener(this) tab_layout.addOnTabSelectedListener(this)
} }
}) })

Loading…
Cancel
Save