pull/1625/head
kunfei 3 years ago
parent 3e4b416fe7
commit 8e665f852e
  1. 6
      app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt

@ -13,6 +13,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.VMBaseFragment import io.legado.app.base.VMBaseFragment
import io.legado.app.constant.AppLog
import io.legado.app.constant.AppPattern import io.legado.app.constant.AppPattern
import io.legado.app.data.appDb import io.legado.app.data.appDb
import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.BookSource
@ -26,6 +27,7 @@ import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding import io.legado.app.utils.viewbindingdelegate.viewBinding
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
/** /**
@ -126,7 +128,9 @@ class ExploreFragment : VMBaseFragment<ExploreViewModel>(R.layout.fragment_explo
appDb.bookSourceDao.flowExplore("%$searchKey%") appDb.bookSourceDao.flowExplore("%$searchKey%")
} }
} }
exploreFlow.collect { exploreFlow.catch {
AppLog.put("发现界面更新数据出错", it)
}.collect {
binding.tvEmptyMsg.isGone = it.isNotEmpty() || searchView.query.isNotEmpty() binding.tvEmptyMsg.isGone = it.isNotEmpty() || searchView.query.isNotEmpty()
adapter.setItems(it, diffItemCallBack) adapter.setItems(it, diffItemCallBack)
} }

Loading…
Cancel
Save