书源管理选择分组时只搜索分组

pull/783/head
gedoor 4 years ago
parent 1767f96de2
commit a9155e6af9
  1. 3
      app/src/main/assets/updateLog.md
  2. 3
      app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt
  3. 6
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt

@ -3,8 +3,9 @@
* 关注合作公众号 **[小说拾遗]** 获取好看的小说。 * 关注合作公众号 **[小说拾遗]** 获取好看的小说。
* 旧版数据导入教程:先在旧版阅读(2.x)中进行备份,然后在新版阅读(3.x)【我的】->【备份与恢复】,选择【导入旧版本数据】。 * 旧版数据导入教程:先在旧版阅读(2.x)中进行备份,然后在新版阅读(3.x)【我的】->【备份与恢复】,选择【导入旧版本数据】。
**2020/01/01** **2020/01/03**
* 导出书单只保留书名与作者,导入时自动查找可用源 * 导出书单只保留书名与作者,导入时自动查找可用源
* 添加预加载设置
**2020/12/30** **2020/12/30**
* 解决文件下载异常,在线语音可正常播放 by [Celeter](https://github.com/Celeter) * 解决文件下载异常,在线语音可正常播放 by [Celeter](https://github.com/Celeter)

@ -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") @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<List<BookSource>> fun liveDataSearch(searchKey: String = ""): LiveData<List<BookSource>>
@Query("select * from book_sources where bookSourceGroup like :searchKey order by customOrder asc")
fun liveDataGroupSearch(searchKey: String = ""): LiveData<List<BookSource>>
@Query("select * from book_sources where enabled = 1 order by customOrder asc") @Query("select * from book_sources where enabled = 1 order by customOrder asc")
fun liveDataEnabled(): LiveData<List<BookSource>> fun liveDataEnabled(): LiveData<List<BookSource>>

@ -139,7 +139,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
R.id.menu_help -> showHelp() R.id.menu_help -> showHelp()
} }
if (item.groupId == R.id.source_group) { if (item.groupId == R.id.source_group) {
searchView.setQuery(item.title, true) searchView.setQuery("group:${item.title}", true)
} }
return super.onCompatOptionsItemSelected(item) return super.onCompatOptionsItemSelected(item)
} }
@ -180,6 +180,10 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
searchKey == getString(R.string.disabled) -> { searchKey == getString(R.string.disabled) -> {
App.db.bookSourceDao.liveDataDisabled() App.db.bookSourceDao.liveDataDisabled()
} }
searchKey.startsWith("group:") -> {
val key = searchKey.substringAfter("group:")
App.db.bookSourceDao.liveDataGroupSearch("%$key%")
}
else -> { else -> {
App.db.bookSourceDao.liveDataSearch("%$searchKey%") App.db.bookSourceDao.liveDataSearch("%$searchKey%")
} }

Loading…
Cancel
Save