mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -98,7 +98,7 @@ interface BookSourceDao {
|
||||
and trim(bookSourceGroup) <> ''
|
||||
order by customOrder"""
|
||||
)
|
||||
fun flowExploreGroup(): Flow<List<String>>
|
||||
fun flowExploreGroupUnProcessed(): Flow<List<String>>
|
||||
|
||||
@Query("select * from book_sources where bookSourceGroup like '%' || :group || '%'")
|
||||
fun getByGroup(group: String): List<BookSource>
|
||||
@@ -180,4 +180,10 @@ interface BookSourceDao {
|
||||
dealGroups(list)
|
||||
}
|
||||
}
|
||||
|
||||
fun flowExploreGroup(): Flow<List<String>> {
|
||||
return flowExploreGroupUnProcessed().map { list ->
|
||||
dealGroups(list)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import io.legado.app.R
|
||||
import io.legado.app.base.VMBaseFragment
|
||||
import io.legado.app.constant.AppLog
|
||||
import io.legado.app.constant.AppPattern
|
||||
import io.legado.app.data.appDb
|
||||
import io.legado.app.data.entities.BookSource
|
||||
import io.legado.app.databinding.FragmentExploreBinding
|
||||
@@ -23,7 +22,10 @@ import io.legado.app.lib.theme.primaryColor
|
||||
import io.legado.app.lib.theme.primaryTextColor
|
||||
import io.legado.app.ui.book.explore.ExploreShowActivity
|
||||
import io.legado.app.ui.book.source.edit.BookSourceEditActivity
|
||||
import io.legado.app.utils.*
|
||||
import io.legado.app.utils.applyTint
|
||||
import io.legado.app.utils.cnCompare
|
||||
import io.legado.app.utils.setEdgeEffectColor
|
||||
import io.legado.app.utils.startActivity
|
||||
import io.legado.app.utils.viewbindingdelegate.viewBinding
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Job
|
||||
@@ -106,9 +108,7 @@ class ExploreFragment : VMBaseFragment<ExploreViewModel>(R.layout.fragment_explo
|
||||
launch {
|
||||
appDb.bookSourceDao.flowExploreGroup().conflate().collect {
|
||||
groups.clear()
|
||||
it.map { group ->
|
||||
groups.addAll(group.splitNotBlank(AppPattern.splitGroupRegex))
|
||||
}
|
||||
groups.addAll(it)
|
||||
upGroupsMenu()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user