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%") }