pull/1603/head
kunfei 3 years ago
parent cd3bb7be86
commit 1583f6c46c
  1. 2
      app/src/main/assets/updateLog.md
  2. 45
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt

@ -11,7 +11,7 @@
* 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。
* 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源!
**2022/02/07**
**2022/02/08**
* 校验失效分组具体到搜索发现目录正文 by Xwite
* txt文件初次解析目录不选择禁用的正则

@ -13,6 +13,7 @@ import androidx.recyclerview.widget.ItemTouchHelper
import com.google.android.material.snackbar.Snackbar
import io.legado.app.R
import io.legado.app.base.VMBaseActivity
import io.legado.app.constant.AppLog
import io.legado.app.constant.AppPattern
import io.legado.app.constant.EventBus
import io.legado.app.data.appDb
@ -207,27 +208,31 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
private fun upBookSource(searchKey: String? = null) {
sourceFlowJob?.cancel()
sourceFlowJob = launch {
when {
searchKey.isNullOrEmpty() -> {
appDb.bookSourceDao.flowAll()
}
searchKey == getString(R.string.enabled) -> {
appDb.bookSourceDao.flowEnabled()
}
searchKey == getString(R.string.disabled) -> {
appDb.bookSourceDao.flowDisabled()
}
searchKey == getString(R.string.need_login) -> {
appDb.bookSourceDao.flowLogin()
}
searchKey.startsWith("group:") -> {
val key = searchKey.substringAfter("group:")
appDb.bookSourceDao.flowGroupSearch("%$key%")
}
else -> {
appDb.bookSourceDao.flowSearch("%$searchKey%")
runCatching {
when {
searchKey.isNullOrEmpty() -> {
appDb.bookSourceDao.flowAll()
}
searchKey == getString(R.string.enabled) -> {
appDb.bookSourceDao.flowEnabled()
}
searchKey == getString(R.string.disabled) -> {
appDb.bookSourceDao.flowDisabled()
}
searchKey == getString(R.string.need_login) -> {
appDb.bookSourceDao.flowLogin()
}
searchKey.startsWith("group:") -> {
val key = searchKey.substringAfter("group:")
appDb.bookSourceDao.flowGroupSearch("%$key%")
}
else -> {
appDb.bookSourceDao.flowSearch("%$searchKey%")
}
}
}.collect { data ->
}.onFailure {
AppLog.put("更新书源出错", it)
}.getOrNull()?.collect { data ->
val sourceList =
if (sortAscending) when (sort) {
Sort.Weight -> data.sortedBy { it.weight }

Loading…
Cancel
Save