From 019c54763e961bca0ed284ec64edb095d05983aa Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 11 May 2022 18:17:36 +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/ChapterListAdapter.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt b/app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt index a87562d07..1bc59c305 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt @@ -19,7 +19,9 @@ import io.legado.app.utils.gone import io.legado.app.utils.longToastOnUi import io.legado.app.utils.visible import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers.Main import kotlinx.coroutines.ensureActive +import kotlinx.coroutines.withContext import java.util.concurrent.ConcurrentHashMap class ChapterListAdapter(context: Context, val callback: Callback) : @@ -84,7 +86,9 @@ class ChapterListAdapter(context: Context, val callback: Callback) : val displayTitle = item.getDisplayTitle(replaceRules, useReplace) ensureActive() displayTitleMap[item.title] = displayTitle - notifyItemChanged(i, true) + withContext(Main) { + notifyItemChanged(i, true) + } } } for (i in 0 until startIndex) { @@ -94,7 +98,9 @@ class ChapterListAdapter(context: Context, val callback: Callback) : val displayTitle = item.getDisplayTitle(replaceRules, useReplace) ensureActive() displayTitleMap[item.title] = displayTitle - notifyItemChanged(i, true) + withContext(Main) { + notifyItemChanged(i, true) + } } } }