|
@@ -4,7 +4,6 @@ import android.app.Application
|
|
|
import android.os.Bundle
|
|
import android.os.Bundle
|
|
|
import androidx.lifecycle.MutableLiveData
|
|
import androidx.lifecycle.MutableLiveData
|
|
|
import androidx.lifecycle.viewModelScope
|
|
import androidx.lifecycle.viewModelScope
|
|
|
-import cn.hutool.core.collection.ConcurrentHashSet
|
|
|
|
|
import io.legado.app.base.BaseViewModel
|
|
import io.legado.app.base.BaseViewModel
|
|
|
import io.legado.app.constant.AppConst
|
|
import io.legado.app.constant.AppConst
|
|
|
import io.legado.app.constant.AppPattern
|
|
import io.legado.app.constant.AppPattern
|
|
@@ -30,6 +29,7 @@ import kotlinx.coroutines.flow.flowOn
|
|
|
import kotlinx.coroutines.flow.map
|
|
import kotlinx.coroutines.flow.map
|
|
|
import splitties.init.appCtx
|
|
import splitties.init.appCtx
|
|
|
import timber.log.Timber
|
|
import timber.log.Timber
|
|
|
|
|
+import java.util.*
|
|
|
import java.util.concurrent.ConcurrentHashMap
|
|
import java.util.concurrent.ConcurrentHashMap
|
|
|
import java.util.concurrent.Executors
|
|
import java.util.concurrent.Executors
|
|
|
import kotlin.math.min
|
|
import kotlin.math.min
|
|
@@ -47,7 +47,7 @@ class ChangeChapterSourceViewModel(application: Application) : BaseViewModel(app
|
|
|
private var tasks = CompositeCoroutine()
|
|
private var tasks = CompositeCoroutine()
|
|
|
private var screenKey: String = ""
|
|
private var screenKey: String = ""
|
|
|
private var bookSourceList = arrayListOf<BookSource>()
|
|
private var bookSourceList = arrayListOf<BookSource>()
|
|
|
- private val searchBooks = ConcurrentHashSet<SearchBook>()
|
|
|
|
|
|
|
+ private val searchBooks = Collections.synchronizedList(arrayListOf<SearchBook>())
|
|
|
private val tocMap = ConcurrentHashMap<String, List<BookChapter>>()
|
|
private val tocMap = ConcurrentHashMap<String, List<BookChapter>>()
|
|
|
private var searchCallback: SourceCallback? = null
|
|
private var searchCallback: SourceCallback? = null
|
|
|
val searchDataFlow = callbackFlow {
|
|
val searchDataFlow = callbackFlow {
|