diff --git a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt index 9a4ce4b86..cb1aa2475 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt @@ -47,7 +47,7 @@ class BookSourceEditActivity : private val qrCodeResult = registerForActivityResult(QrCodeResult()) { it ?: return@registerForActivityResult viewModel.importSource(it) { source -> - upRecyclerView(source) + upSourceView(source) } } private val selectDoc = registerForActivityResult(HandleFileContract()) { @@ -68,7 +68,7 @@ class BookSourceEditActivity : softKeyboardTool.attachToWindow(window) initView() viewModel.initData(intent) { - upRecyclerView() + upSourceView() } } @@ -112,7 +112,7 @@ class BookSourceEditActivity : R.id.menu_clear_cookie -> viewModel.clearCookie(getSource().bookSourceUrl) R.id.menu_auto_complete -> viewModel.autoComplete = !viewModel.autoComplete R.id.menu_copy_source -> sendToClip(GSON.toJson(getSource())) - R.id.menu_paste_source -> viewModel.pasteSource { upRecyclerView(it) } + R.id.menu_paste_source -> viewModel.pasteSource { upSourceView(it) } R.id.menu_qr_code_camera -> qrCodeResult.launch() R.id.menu_share_str -> share(GSON.toJson(getSource())) R.id.menu_share_qr -> shareWithQr( @@ -187,7 +187,7 @@ class BookSourceEditActivity : binding.recyclerView.scrollToPosition(0) } - private fun upRecyclerView(source: BookSource? = viewModel.bookSource) { + private fun upSourceView(source: BookSource? = viewModel.bookSource) { source?.let { binding.cbIsEnable.isChecked = it.enabled binding.cbIsEnableFind.isChecked = it.enabledExplore diff --git a/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt index aac1bda3b..01bd4bbe6 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt @@ -48,7 +48,7 @@ class RssSourceEditActivity : private val qrCodeResult = registerForActivityResult(QrCodeResult()) { it?.let { viewModel.importSource(it) { source: RssSource -> - upRecyclerView(source) + upSourceView(source) } } } @@ -57,7 +57,7 @@ class RssSourceEditActivity : softKeyboardTool.attachToWindow(window) initView() viewModel.initData(intent) { - upRecyclerView() + upSourceView() } } @@ -134,7 +134,7 @@ class RssSourceEditActivity : R.id.menu_auto_complete -> viewModel.autoComplete = !viewModel.autoComplete R.id.menu_copy_source -> sendToClip(GSON.toJson(getRssSource())) R.id.menu_qr_code_camera -> qrCodeResult.launch() - R.id.menu_paste_source -> viewModel.pasteSource { upRecyclerView(it) } + R.id.menu_paste_source -> viewModel.pasteSource { upSourceView(it) } R.id.menu_share_str -> share(GSON.toJson(getRssSource())) R.id.menu_share_qr -> shareWithQr( GSON.toJson(getRssSource()), @@ -151,10 +151,11 @@ class RssSourceEditActivity : binding.recyclerView.adapter = adapter } - private fun upRecyclerView(source: RssSource? = viewModel.rssSource) { + private fun upSourceView(source: RssSource? = viewModel.rssSource) { source?.let { binding.cbIsEnable.isChecked = source.enabled binding.cbSingleUrl.isChecked = source.singleUrl + binding.cbIsEnableCookie.isChecked = source.enabledCookieJar == true binding.cbEnableJs.isChecked = source.enableJs binding.cbEnableBaseUrl.isChecked = source.loadWithBaseUrl } @@ -192,6 +193,7 @@ class RssSourceEditActivity : val source = viewModel.rssSource source.enabled = binding.cbIsEnable.isChecked source.singleUrl = binding.cbSingleUrl.isChecked + source.enabledCookieJar = binding.cbIsEnableCookie.isChecked source.enableJs = binding.cbEnableJs.isChecked source.loadWithBaseUrl = binding.cbEnableBaseUrl.isChecked sourceEntities.forEach { diff --git a/app/src/main/res/layout/activity_rss_source_edit.xml b/app/src/main/res/layout/activity_rss_source_edit.xml index d839b5170..6baf96b5f 100644 --- a/app/src/main/res/layout/activity_rss_source_edit.xml +++ b/app/src/main/res/layout/activity_rss_source_edit.xml @@ -45,6 +45,13 @@ android:text="@string/single_url" tools:ignore="TouchTargetSizeCheck" /> + +