pull/1876/head^2
kunfei 3 years ago
parent 019c54763e
commit d3d0e0e1d2
  1. 1
      app/src/main/assets/updateLog.md
  2. 7
      app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt

@ -14,6 +14,7 @@
**2022/05/11** **2022/05/11**
* 修复替换报错的bug * 修复替换报错的bug
* 优化目录界面替换
**2022/05/10** **2022/05/10**

@ -20,6 +20,7 @@ import io.legado.app.utils.longToastOnUi
import io.legado.app.utils.visible import io.legado.app.utils.visible
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers.Main import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.async
import kotlinx.coroutines.ensureActive import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentHashMap
@ -79,6 +80,7 @@ class ChapterListAdapter(context: Context, val callback: Callback) :
val replaceRules = replaceRules val replaceRules = replaceRules
val useReplace = useReplace val useReplace = useReplace
val items = getItems() val items = getItems()
async {
for (i in startIndex until items.size) { for (i in startIndex until items.size) {
val item = items[i] val item = items[i]
if (displayTitleMap[item.title] == null) { if (displayTitleMap[item.title] == null) {
@ -91,7 +93,9 @@ class ChapterListAdapter(context: Context, val callback: Callback) :
} }
} }
} }
for (i in 0 until startIndex) { }.start()
async {
for (i in startIndex downTo 0) {
val item = items[i] val item = items[i]
if (displayTitleMap[item.title] == null) { if (displayTitleMap[item.title] == null) {
ensureActive() ensureActive()
@ -103,6 +107,7 @@ class ChapterListAdapter(context: Context, val callback: Callback) :
} }
} }
} }
}.start()
} }
} }

Loading…
Cancel
Save