From 385843dc068543527003dd8b29ef590668ce42d0 Mon Sep 17 00:00:00 2001 From: GKF Date: Thu, 6 Jun 2019 09:04:52 +0800 Subject: [PATCH] up --- .../java/io/legado/app/ui/main/myconfig/MyConfigFragment.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/main/myconfig/MyConfigFragment.kt b/app/src/main/java/io/legado/app/ui/main/myconfig/MyConfigFragment.kt index 1b524c255..f54a7243b 100644 --- a/app/src/main/java/io/legado/app/ui/main/myconfig/MyConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/myconfig/MyConfigFragment.kt @@ -14,7 +14,10 @@ class MyConfigFragment : BaseFragment(R.layout.fragment_my_config) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { setSupportToolbar(toolbar) - childFragmentManager.beginTransaction().add(R.id.pre_fragment, PreferenceFragment()).commit() + val fragmentTag = "prefFragment" + var preferenceFragment = childFragmentManager.findFragmentByTag(fragmentTag) + if (preferenceFragment == null) preferenceFragment = PreferenceFragment() + childFragmentManager.beginTransaction().replace(R.id.pre_fragment, preferenceFragment, fragmentTag).commit() } override fun onCompatCreateOptionsMenu(menu: Menu) {