pull/1625/head
kunfei 3 years ago
parent 775426c908
commit 62acbdd280
  1. 3
      app/src/main/java/io/legado/app/ui/book/toc/BookmarkFragment.kt
  2. 3
      app/src/main/java/io/legado/app/ui/book/toc/ChapterListFragment.kt
  3. 7
      app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt
  4. 7
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt

@ -17,6 +17,7 @@ import io.legado.app.utils.setEdgeEffectColor
import io.legado.app.utils.showDialogFragment
import io.legado.app.utils.viewbindingdelegate.viewBinding
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
@ -50,7 +51,7 @@ class BookmarkFragment : VMBaseFragment<TocViewModel>(R.layout.fragment_bookmark
when {
searchKey.isNullOrBlank() -> appDb.bookmarkDao.flowByBook(book.name, book.author)
else -> appDb.bookmarkDao.flowSearch(book.name, book.author, searchKey)
}.collect {
}.collectLatest {
adapter.setItems(it)
}
}

@ -25,6 +25,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@ -110,7 +111,7 @@ class ChapterListFragment : VMBaseFragment<TocViewModel>(R.layout.fragment_chapt
when {
searchKey.isNullOrBlank() -> appDb.bookChapterDao.flowByBook(viewModel.bookUrl)
else -> appDb.bookChapterDao.flowSearch(viewModel.bookUrl, searchKey)
}.collect {
}.collectLatest {
if (!(searchKey.isNullOrBlank() && it.isEmpty())) {
adapter.setItems(it, adapter.diffCallBack)
adapter.upDisplayTile()

@ -14,6 +14,7 @@ import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager
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.data.appDb
import io.legado.app.data.entities.ReplaceRule
@ -37,6 +38,8 @@ import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
/**
@ -190,7 +193,9 @@ class ReplaceRuleActivity : VMBaseActivity<ActivityReplaceRuleBinding, ReplaceRu
else -> {
appDb.replaceRuleDao.flowSearch("%$searchKey%")
}
}.collect {
}.catch {
AppLog.put("替换规则管理界面更新数据出错", it)
}.collectLatest {
if (dataInit) {
setResult(Activity.RESULT_OK)
}

@ -11,6 +11,7 @@ import androidx.appcompat.widget.SearchView
import androidx.recyclerview.widget.ItemTouchHelper
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.data.appDb
import io.legado.app.data.entities.RssSource
@ -32,6 +33,8 @@ import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
/**
@ -243,7 +246,9 @@ class RssSourceActivity : VMBaseActivity<ActivityRssSourceBinding, RssSourceView
else -> {
appDb.rssSourceDao.flowSearch("%$searchKey%")
}
}.collect {
}.catch {
AppLog.put("订阅源管理界面更新数据出错", it)
}.collectLatest {
adapter.setItems(it, adapter.diffItemCallback)
}
}

Loading…
Cancel
Save