From 9d52d3402d6fc1cedb2c406ff2667cfd22630e2e Mon Sep 17 00:00:00 2001 From: okou19900722 Date: Tue, 31 Oct 2023 11:31:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B9=A6=E6=BA=90=E7=AE=A1=E7=90=86=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E6=B7=BB=E5=8A=A0=E7=AD=9B=E9=80=89=E6=96=B9=E5=BC=8F?= =?UTF-8?q?--=E6=98=AF=E5=90=A6=E5=BC=80=E5=90=AF=E5=8F=91=E7=8E=B0?= =?UTF-8?q?=E3=80=82=20resolved=20#3454?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/data/dao/BookSourceDao.kt | 20 +++++++++++++++++++ .../book/source/manage/BookSourceActivity.kt | 16 +++++++++++++++ .../book/source/manage/BookSourceViewModel.kt | 8 ++++++++ app/src/main/res/menu/book_source.xml | 8 ++++++++ app/src/main/res/values-es-rES/strings.xml | 2 ++ app/src/main/res/values-ja-rJP/strings.xml | 2 ++ app/src/main/res/values-pt-rBR/strings.xml | 2 ++ app/src/main/res/values-vi/strings.xml | 2 ++ app/src/main/res/values-zh-rHK/strings.xml | 2 ++ app/src/main/res/values-zh-rTW/strings.xml | 2 ++ app/src/main/res/values-zh/strings.xml | 2 ++ app/src/main/res/values/strings.xml | 2 ++ 12 files changed, 68 insertions(+) diff --git a/app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt b/app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt index 27c2fd6b0..ac7ec92b0 100644 --- a/app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt @@ -111,6 +111,20 @@ interface BookSourceDao { ) fun flowNoGroup(): Flow> + @Query( + """select bookSourceUrl, bookSourceName, bookSourceGroup, customOrder, enabled, enabledExplore, + trim(loginUrl) <> '' hasLoginUrl, lastUpdateTime, respondTime, weight, trim(exploreUrl) <> '' hasExploreUrl + from book_sources where enabledExplore = 1 order by customOrder asc""" + ) + fun flowEnabledExplore(): Flow> + + @Query( + """select bookSourceUrl, bookSourceName, bookSourceGroup, customOrder, enabled, enabledExplore, + trim(loginUrl) <> '' hasLoginUrl, lastUpdateTime, respondTime, weight, trim(exploreUrl) <> '' hasExploreUrl + from book_sources where enabledExplore = 0 order by customOrder asc""" + ) + fun flowDisabledExplore(): Flow> + @Query( """select * from book_sources where enabledExplore = 1 @@ -193,6 +207,12 @@ interface BookSourceDao { @get:Query("select * from book_sources where bookSourceGroup is null or bookSourceGroup = '' or bookSourceGroup like '%未分组%'") val allNoGroup: List + @get:Query("select * from book_sources where enabledExplore = 1 order by customOrder") + val allEnabledExplore: List + + @get:Query("select * from book_sources where enabledExplore = 0 order by customOrder") + val allDisabledExplore: List + @get:Query("select * from book_sources where loginUrl is not null and loginUrl != ''") val allLogin: List diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt index ea6c08960..37d3c81cb 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt @@ -217,6 +217,14 @@ class BookSourceActivity : VMBaseActivity { + searchView.setQuery(getString(R.string.enabled_explore), true) + } + + R.id.menu_disabled_explore_group -> { + searchView.setQuery(getString(R.string.disabled_explore), true) + } + R.id.menu_help -> showHelp() } if (item.groupId == R.id.source_group) { @@ -272,6 +280,14 @@ class BookSourceActivity : VMBaseActivity { + appDb.bookSourceDao.flowEnabledExplore() + } + + searchKey == getString(R.string.disabled_explore) -> { + appDb.bookSourceDao.flowDisabledExplore() + } + searchKey.startsWith("group:") -> { val key = searchKey.substringAfter("group:") appDb.bookSourceDao.flowGroupSearch(key) diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt index 6d4824667..3179e9371 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt @@ -191,6 +191,14 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application) appDb.bookSourceDao.allNoGroup } + searchKey == appCtx.getString(R.string.enabled_explore) -> { + appDb.bookSourceDao.allEnabledExplore + } + + searchKey == appCtx.getString(R.string.disabled_explore) -> { + appDb.bookSourceDao.allDisabledExplore + } + searchKey.startsWith("group:") -> { val key = searchKey.substringAfter("group:") appDb.bookSourceDao.groupSearch(key) diff --git a/app/src/main/res/menu/book_source.xml b/app/src/main/res/menu/book_source.xml index 3b4192d22..64421ae41 100644 --- a/app/src/main/res/menu/book_source.xml +++ b/app/src/main/res/menu/book_source.xml @@ -92,6 +92,14 @@ android:id="@+id/menu_group_null" android:title="@string/no_group" /> + + + + diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index 82a79b225..be9c51bc7 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -729,6 +729,8 @@ Seleccione una carpeta de respaldo heredada Activado Desactivado + Discovery Enabled + Discovery Disabled Iniciando descarga Este libro ya está en la lista de descargas Haga clic para abrir diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index 98ad5bd41..c519981af 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -732,6 +732,8 @@ Select a legacy backup folder Enabled Disabled + Discovery Enabled + Discovery Disabled Starting download This book is already in Download list Click to open diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index ce36d0e71..230a81a2e 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -730,6 +730,8 @@ Selecione uma pasta Legado de Backup Ativado Desativado + Discovery Enabled + Discovery Disabled Iniciando o download Este livro já está na lista de download Clique para abrir diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 6076a7620..6ea9b1db4 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -730,6 +730,8 @@ Còn Chọn thư mục sao lưu kế thừa Đã bật Đã tắt + Discovery Enabled + Discovery Disabled Bắt đầu tải xuống Cuốn sách này đã có trong danh sách Download Nhấp để mở diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 509050551..8d1f13539 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -723,6 +723,8 @@ 選擇舊版備份文件夾 已啓用 已禁用 + 已啟用發現 + 已禁用發現 文字底部對齊 正在啟動下載 該書已在下載列表 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index a72d9a30f..4928b292a 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -731,6 +731,8 @@ 選擇舊版備份資料夾 已啟用 已禁用 + 已啟用發現 + 已禁用發現 正在啟動下載 該書已在下載列表 點擊打開 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 8bd2967e0..d642d1532 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -732,6 +732,8 @@ 选择旧版备份文件夹 已启用 已禁用 + 已启用发现 + 已禁用发现 正在启动下载 该书已在下载列表 点击打开 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8f80271b0..1fd692023 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -734,6 +734,8 @@ Select a legacy backup folder Enabled Disabled + Discovery Enabled + Discovery Disabled Starting download This book is already in Download list Click to open