diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index be57bb15c..105bae5e3 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -11,7 +11,7 @@ * 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。 * 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源! -**2022/02/07** +**2022/02/08** * 校验失效分组具体到搜索发现目录正文 by Xwite * txt文件初次解析目录不选择禁用的正则 diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt index 0f0e8e0e1..3d2620f72 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt @@ -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 { - 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 }