|
|
@ -18,6 +18,8 @@ import io.legado.app.utils.gone |
|
|
|
import io.legado.app.utils.visible |
|
|
|
import io.legado.app.utils.visible |
|
|
|
import kotlinx.coroutines.CoroutineScope |
|
|
|
import kotlinx.coroutines.CoroutineScope |
|
|
|
import kotlinx.coroutines.Dispatchers.IO |
|
|
|
import kotlinx.coroutines.Dispatchers.IO |
|
|
|
|
|
|
|
import kotlinx.coroutines.Job |
|
|
|
|
|
|
|
import kotlinx.coroutines.isActive |
|
|
|
import kotlinx.coroutines.launch |
|
|
|
import kotlinx.coroutines.launch |
|
|
|
import java.util.concurrent.ConcurrentHashMap |
|
|
|
import java.util.concurrent.ConcurrentHashMap |
|
|
|
|
|
|
|
|
|
|
@ -56,12 +58,17 @@ class ChapterListAdapter(context: Context, val callback: Callback) : |
|
|
|
} |
|
|
|
} |
|
|
|
private val useReplace |
|
|
|
private val useReplace |
|
|
|
get() = AppConfig.tocUiUseReplace && callback.book?.getUseReplaceRule() == true |
|
|
|
get() = AppConfig.tocUiUseReplace && callback.book?.getUseReplaceRule() == true |
|
|
|
|
|
|
|
private var upDisplayTileJob: Job? = null |
|
|
|
|
|
|
|
|
|
|
|
fun upDisplayTile() { |
|
|
|
fun upDisplayTile() { |
|
|
|
callback.scope.launch(IO) { |
|
|
|
upDisplayTileJob?.cancel() |
|
|
|
|
|
|
|
upDisplayTileJob = callback.scope.launch(IO) { |
|
|
|
val replaceRules = replaceRules |
|
|
|
val replaceRules = replaceRules |
|
|
|
val useReplace = useReplace |
|
|
|
val useReplace = useReplace |
|
|
|
getItems().forEach { |
|
|
|
getItems().forEach { |
|
|
|
|
|
|
|
if (!isActive) { |
|
|
|
|
|
|
|
return@launch |
|
|
|
|
|
|
|
} |
|
|
|
if (displayTileMap[it.index] == null) { |
|
|
|
if (displayTileMap[it.index] == null) { |
|
|
|
displayTileMap[it.index] = it.getDisplayTitle(replaceRules, useReplace) |
|
|
|
displayTileMap[it.index] = it.getDisplayTitle(replaceRules, useReplace) |
|
|
|
} |
|
|
|
} |
|
|
|