|
|
@ -12,7 +12,7 @@ import io.legado.app.data.entities.SearchBook |
|
|
|
import io.legado.app.data.entities.SearchKeyword |
|
|
|
import io.legado.app.data.entities.SearchKeyword |
|
|
|
import io.legado.app.help.config.AppConfig |
|
|
|
import io.legado.app.help.config.AppConfig |
|
|
|
import io.legado.app.model.webBook.SearchModel |
|
|
|
import io.legado.app.model.webBook.SearchModel |
|
|
|
import io.legado.app.utils.DelayLiveData |
|
|
|
import io.legado.app.utils.ConflateLiveData |
|
|
|
import io.legado.app.utils.toastOnUi |
|
|
|
import io.legado.app.utils.toastOnUi |
|
|
|
import kotlinx.coroutines.ExperimentalCoroutinesApi |
|
|
|
import kotlinx.coroutines.ExperimentalCoroutinesApi |
|
|
|
import kotlinx.coroutines.flow.mapLatest |
|
|
|
import kotlinx.coroutines.flow.mapLatest |
|
|
@ -22,7 +22,7 @@ class SearchViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
val handler = Handler(Looper.getMainLooper()) |
|
|
|
val handler = Handler(Looper.getMainLooper()) |
|
|
|
val bookshelf = hashSetOf<String>() |
|
|
|
val bookshelf = hashSetOf<String>() |
|
|
|
val upAdapterLiveData = MutableLiveData<String>() |
|
|
|
val upAdapterLiveData = MutableLiveData<String>() |
|
|
|
var searchBookLiveData = DelayLiveData<List<SearchBook>>(1000) |
|
|
|
var searchBookLiveData = ConflateLiveData<List<SearchBook>>(1000) |
|
|
|
val searchScope: SearchScope = SearchScope(AppConfig.searchScope) |
|
|
|
val searchScope: SearchScope = SearchScope(AppConfig.searchScope) |
|
|
|
var searchFinishCallback: ((isEmpty: Boolean) -> Unit)? = null |
|
|
|
var searchFinishCallback: ((isEmpty: Boolean) -> Unit)? = null |
|
|
|
var isSearchLiveData = MutableLiveData<Boolean>() |
|
|
|
var isSearchLiveData = MutableLiveData<Boolean>() |
|
|
|