From 273d465e080304e49922bbdc0ce9f3ac7a023a2f Mon Sep 17 00:00:00 2001 From: AndyBernie Date: Tue, 22 Sep 2020 12:31:23 +0800 Subject: [PATCH] add options --- app/src/main/java/io/legado/app/constant/PreferKey.kt | 1 + .../legado/app/ui/book/changesource/ChangeSourceDialog.kt | 6 ++++++ .../app/ui/book/changesource/ChangeSourceViewModel.kt | 4 +++- app/src/main/res/menu/change_source.xml | 6 ++++++ app/src/main/res/values-zh-rHK/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values-zh/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 8 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/constant/PreferKey.kt b/app/src/main/java/io/legado/app/constant/PreferKey.kt index f40091b0f..7ef56460e 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -35,6 +35,7 @@ object PreferKey { const val webDavCreateDir = "webDavCreateDir" const val webDavCacheBackup = "webDavCacheBackup" const val changeSourceLoadToc = "changeSourceLoadToc" + const val changeSourceLoadInfo = "changeSourceLoadInfo" const val chineseConverterType = "chineseConverterType" const val launcherIcon = "launcherIcon" const val textSelectAble = "selectText" diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt index bbd627466..e73b443a6 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt @@ -88,6 +88,8 @@ class ChangeSourceDialog : BaseDialogFragment(), tool_bar.setOnMenuItemClickListener(this) tool_bar.menu.findItem(R.id.menu_load_toc)?.isChecked = getPrefBoolean(PreferKey.changeSourceLoadToc) + tool_bar.menu.findItem(R.id.menu_load_info)?.isChecked = + getPrefBoolean(PreferKey.changeSourceLoadInfo) } private fun initRecyclerView() { @@ -159,6 +161,10 @@ class ChangeSourceDialog : BaseDialogFragment(), putPrefBoolean(PreferKey.changeSourceLoadToc, !item.isChecked) item.isChecked = !item.isChecked } + R.id.menu_load_info -> { + putPrefBoolean(PreferKey.changeSourceLoadInfo, !item.isChecked) + item.isChecked = !item.isChecked + } R.id.menu_stop -> viewModel.stopSearch() } return false diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt index 581ad9f41..6633a889d 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt @@ -121,7 +121,9 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio it.forEach { searchBook -> if (searchBook.name == name && searchBook.author == author) { if (searchBook.latestChapterTitle.isNullOrEmpty()) { - loadBookInfo(searchBook.toBook()) + if (context.getPrefBoolean(PreferKey.changeSourceLoadInfo)) { + loadBookInfo(searchBook.toBook()) + } } else { searchFinish(searchBook) } diff --git a/app/src/main/res/menu/change_source.xml b/app/src/main/res/menu/change_source.xml index ab2bfee4c..dd2deae1b 100644 --- a/app/src/main/res/menu/change_source.xml +++ b/app/src/main/res/menu/change_source.xml @@ -24,4 +24,10 @@ android:checkable="true" app:showAsAction="never" /> + + \ No newline at end of file diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 72b0eaa2f..4d38941b5 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -568,6 +568,7 @@ 導出所選 導出 加載目錄 + 加載詳情頁 TTS WebDav 密碼 輸入你的 WebDav 授權密碼 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 69c410eaa..6335186ca 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -569,6 +569,7 @@ 匯出所選 匯出 載入目錄 + 載入詳情頁 TTS WebDav 密碼 輸入你的WebDav授權密碼 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 76b0b02c1..92977d3f5 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -575,6 +575,7 @@ 导出所选 导出 加载目录 + 加载详情页 TTS WebDav 密码 输入你的WebDav授权密码 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4343ffa11..4779b5909 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -577,6 +577,7 @@ Export selected Export Load chapters + Load book detail TTS WebDav password Input you WebDav authorized password