pull/37/head
kunfei 6 years ago
parent df2898a4f2
commit e29bd6b3ef
  1. 3
      app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt

@ -23,6 +23,9 @@ interface BookSourceDao {
@Query("select bookSourceGroup from book_sources where bookSourceGroup is not null and bookSourceGroup <> ''")
fun liveGroup(): LiveData<List<String>>
@Query("select bookSourceGroup from book_sources where enabled = 1 and bookSourceGroup is not null and bookSourceGroup <> ''")
fun liveGroupEnabled(): LiveData<List<String>>
@Query("select distinct enabled from book_sources where bookSourceName like :searchKey or bookSourceGroup like :searchKey or bookSourceUrl like :searchKey")
fun searchIsEnable(searchKey: String = ""): List<Boolean>

@ -155,7 +155,7 @@ class SearchActivity : VMBaseActivity<SearchViewModel>(R.layout.activity_book_se
), 30
).build()
searchBookData?.observe(this, Observer { adapter.submitList(it) })
App.db.bookSourceDao().liveGroup().observe(this, Observer {
App.db.bookSourceDao().liveGroupEnabled().observe(this, Observer {
groups.clear()
it.map { group ->
groups.addAll(group.splitNotBlank(",", ";"))

Loading…
Cancel
Save