From 0039473314618e38ee91e59dca27fd6dfdbfb0a9 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 9 Feb 2022 23:28:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/toc/ChapterListFragment.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListFragment.kt b/app/src/main/java/io/legado/app/ui/book/toc/ChapterListFragment.kt index 218d96d6e..9694f3e72 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListFragment.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/ChapterListFragment.kt @@ -22,12 +22,9 @@ import io.legado.app.ui.widget.recycler.VerticalDivider import io.legado.app.utils.ColorUtils import io.legado.app.utils.observeEvent import io.legado.app.utils.viewbindingdelegate.viewBinding +import kotlinx.coroutines.* import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.Main -import kotlinx.coroutines.Job -import kotlinx.coroutines.async -import kotlinx.coroutines.launch -import kotlinx.coroutines.withContext class ChapterListFragment : VMBaseFragment(R.layout.fragment_chapter_list), ChapterListAdapter.Callback, @@ -119,7 +116,11 @@ class ChapterListFragment : VMBaseFragment(R.layout.fragment_chapt } val useReplace = viewModel.bookData.value?.getUseReplaceRule() == true it.map { chapter -> - Pair(chapter, async { chapter.getDisplayTitle(replaces, useReplace) }) + Pair( + chapter, + async(start = CoroutineStart.LAZY) { + chapter.getDisplayTitle(replaces, useReplace) + }) } } adapter.setItems(data, adapter.diffCallBack)