From fdd625cd333e9a3f08aeaa1a978ab4fb94b32b26 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 26 Aug 2020 14:14:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/main/bookshelf/BookshelfFragment.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 1466f92f0..9abfddbd4 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 @@ -11,7 +11,6 @@ import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentStatePagerAdapter import androidx.lifecycle.LiveData -import androidx.lifecycle.Observer import com.google.android.material.tabs.TabLayout import io.legado.app.App import io.legado.app.R @@ -114,7 +113,7 @@ class BookshelfFragment : VMBaseFragment(R.layout.fragment_b private fun initBookGroupData() { bookGroupLiveData?.removeObservers(viewLifecycleOwner) bookGroupLiveData = App.db.bookGroupDao().liveDataAll() - bookGroupLiveData?.observe(viewLifecycleOwner, Observer { + bookGroupLiveData?.observe(viewLifecycleOwner, { viewModel.checkGroup(it) launch { synchronized(this) { @@ -152,7 +151,7 @@ class BookshelfFragment : VMBaseFragment(R.layout.fragment_b }) noGroupLiveData?.removeObservers(viewLifecycleOwner) noGroupLiveData = App.db.bookDao().observeNoGroupSize() - noGroupLiveData?.observe(viewLifecycleOwner, Observer { + noGroupLiveData?.observe(viewLifecycleOwner, { if (it > 0 && !showGroupNone && AppConfig.bookGroupNoneShow) { showGroupNone = true upGroup() @@ -270,7 +269,7 @@ class BookshelfFragment : VMBaseFragment(R.layout.fragment_b fragmentMap[selectedGroup?.groupId]?.gotoTop() } - private inner class TabFragmentPageAdapter internal constructor(fm: FragmentManager) : + private inner class TabFragmentPageAdapter(fm: FragmentManager) : FragmentStatePagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) { override fun getPageTitle(position: Int): CharSequence? {