pull/2274/head
kunfei 3 years ago
parent 9fee4f4025
commit 0e5dce5c4d
  1. 6
      app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt
  2. 2
      app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt

@ -98,7 +98,7 @@ interface BookSourceDao {
and trim(bookSourceGroup) <> '' and trim(bookSourceGroup) <> ''
order by customOrder""" order by customOrder"""
) )
fun flowExploreGroupUnProcessed(): Flow<List<String>> fun flowExploreGroupsUnProcessed(): Flow<List<String>>
@Query("select * from book_sources where bookSourceGroup like '%' || :group || '%'") @Query("select * from book_sources where bookSourceGroup like '%' || :group || '%'")
fun getByGroup(group: String): List<BookSource> fun getByGroup(group: String): List<BookSource>
@ -181,8 +181,8 @@ interface BookSourceDao {
} }
} }
fun flowExploreGroup(): Flow<List<String>> { fun flowExploreGroups(): Flow<List<String>> {
return flowExploreGroupUnProcessed().map { list -> return flowExploreGroupsUnProcessed().map { list ->
dealGroups(list) dealGroups(list)
} }
} }

@ -106,7 +106,7 @@ class ExploreFragment : VMBaseFragment<ExploreViewModel>(R.layout.fragment_explo
private fun initGroupData() { private fun initGroupData() {
launch { launch {
appDb.bookSourceDao.flowExploreGroup().conflate().collect { appDb.bookSourceDao.flowExploreGroups().conflate().collect {
groups.clear() groups.clear()
groups.addAll(it) groups.addAll(it)
upGroupsMenu() upGroupsMenu()

Loading…
Cancel
Save