From a9155e6af952c6ea1c163b32659e2176635dd4a5 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 3 Jan 2021 20:21:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B9=A6=E6=BA=90=E7=AE=A1=E7=90=86=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=88=86=E7=BB=84=E6=97=B6=E5=8F=AA=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=88=86=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/updateLog.md | 3 ++- app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt | 3 +++ .../legado/app/ui/book/source/manage/BookSourceActivity.kt | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index 186c29916..5a61a7d4e 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -3,8 +3,9 @@ * 关注合作公众号 **[小说拾遗]** 获取好看的小说。 * 旧版数据导入教程:先在旧版阅读(2.x)中进行备份,然后在新版阅读(3.x)【我的】->【备份与恢复】,选择【导入旧版本数据】。 -**2020/01/01** +**2020/01/03** * 导出书单只保留书名与作者,导入时自动查找可用源 +* 添加预加载设置 **2020/12/30** * 解决文件下载异常,在线语音可正常播放 by [Celeter](https://github.com/Celeter) 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 e7ffc7fe0..560a92a76 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 @@ -14,6 +14,9 @@ interface BookSourceDao { @Query("select * from book_sources where bookSourceName like :searchKey or bookSourceGroup like :searchKey or bookSourceUrl like :searchKey or bookSourceComment like :searchKey order by customOrder asc") fun liveDataSearch(searchKey: String = ""): LiveData> + @Query("select * from book_sources where bookSourceGroup like :searchKey order by customOrder asc") + fun liveDataGroupSearch(searchKey: String = ""): LiveData> + @Query("select * from book_sources where enabled = 1 order by customOrder asc") fun liveDataEnabled(): LiveData> 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 38c138482..0aeceded0 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 @@ -139,7 +139,7 @@ class BookSourceActivity : VMBaseActivity showHelp() } if (item.groupId == R.id.source_group) { - searchView.setQuery(item.title, true) + searchView.setQuery("group:${item.title}", true) } return super.onCompatOptionsItemSelected(item) } @@ -180,6 +180,10 @@ class BookSourceActivity : VMBaseActivity { App.db.bookSourceDao.liveDataDisabled() } + searchKey.startsWith("group:") -> { + val key = searchKey.substringAfter("group:") + App.db.bookSourceDao.liveDataGroupSearch("%$key%") + } else -> { App.db.bookSourceDao.liveDataSearch("%$searchKey%") }