diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt index 86a209bad..5b946d74d 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt @@ -93,6 +93,7 @@ class BookshelfFragment : VMBaseFragment(R.layout.fragment_b bookGroupLiveData = App.db.bookGroupDao().liveDataAll() bookGroupLiveData?.observe(viewLifecycleOwner, Observer { synchronized(this) { + tab_layout.removeOnTabSelectedListener(this) bookGroups.clear() bookGroups.add(AppConst.bookGroupAll) if (AppConst.bookGroupLocalShow) { @@ -104,7 +105,6 @@ class BookshelfFragment : VMBaseFragment(R.layout.fragment_b bookGroups.addAll(it) view_pager_bookshelf.adapter?.notifyDataSetChanged() tab_layout.getTabAt(getPrefInt(PreferKey.saveTabPosition, 0))?.select() - tab_layout.removeOnTabSelectedListener(this) tab_layout.addOnTabSelectedListener(this) } })