From fc28ac232a3be2ef7f72011fba81f7ac53f50542 Mon Sep 17 00:00:00 2001 From: GKF Date: Thu, 6 Jun 2019 13:59:51 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/config/ConfigActivity.kt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/config/ConfigActivity.kt b/app/src/main/java/io/legado/app/ui/config/ConfigActivity.kt index b37b3cdb1..6b8a67517 100644 --- a/app/src/main/java/io/legado/app/ui/config/ConfigActivity.kt +++ b/app/src/main/java/io/legado/app/ui/config/ConfigActivity.kt @@ -22,20 +22,29 @@ class ConfigActivity : BaseActivity() { when (viewModel.configType) { ConfigViewModel.TYPE_CONFIG -> { title_bar.title = "设置" + val fTag = "configFragment" + var configFragment = supportFragmentManager.findFragmentByTag(fTag) + if (configFragment == null) configFragment = ConfigFragment() supportFragmentManager.beginTransaction() - .replace(R.id.configFrameLayout, ConfigFragment()) + .replace(R.id.configFrameLayout, configFragment, fTag) .commit() } ConfigViewModel.TYPE_THEME_CONFIG -> { title_bar.title = "主题设置" + val fTag = "themeConfigFragment" + var configFragment = supportFragmentManager.findFragmentByTag(fTag) + if (configFragment == null) configFragment = ThemeConfigFragment() supportFragmentManager.beginTransaction() - .replace(R.id.configFrameLayout, ThemeConfigFragment()) + .replace(R.id.configFrameLayout, configFragment, fTag) .commit() } ConfigViewModel.TYPE_WEB_DAV_CONFIG -> { title_bar.title = "WebDav设置" + val fTag = "webDavFragment" + var configFragment = supportFragmentManager.findFragmentByTag(fTag) + if (configFragment == null) configFragment = WebDavConfigFragment() supportFragmentManager.beginTransaction() - .replace(R.id.configFrameLayout, WebDavConfigFragment()) + .replace(R.id.configFrameLayout, configFragment, fTag) .commit() } }