mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -57,6 +57,7 @@ class ExploreFragment : VMBaseFragment<ExploreViewModel>(R.layout.fragment_explo
|
||||
private var exploreFlowJob: Job? = null
|
||||
private var groupsMenu: SubMenu? = null
|
||||
private var isActive = false
|
||||
private var searchKey: String? = null
|
||||
|
||||
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
||||
setSupportToolbar(binding.titleBar.toolbar)
|
||||
@@ -123,6 +124,7 @@ class ExploreFragment : VMBaseFragment<ExploreViewModel>(R.layout.fragment_explo
|
||||
}
|
||||
|
||||
private fun upExploreData(searchKey: String? = null, once: Boolean = false) {
|
||||
this.searchKey = searchKey
|
||||
exploreFlowJob?.cancel()
|
||||
exploreFlowJob = launch {
|
||||
when {
|
||||
@@ -213,7 +215,7 @@ class ExploreFragment : VMBaseFragment<ExploreViewModel>(R.layout.fragment_explo
|
||||
|
||||
override fun onActive() {
|
||||
isActive = true
|
||||
upExploreData()
|
||||
upExploreData(searchKey)
|
||||
}
|
||||
|
||||
override fun onInactive() {
|
||||
@@ -223,7 +225,7 @@ class ExploreFragment : VMBaseFragment<ExploreViewModel>(R.layout.fragment_explo
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (isActive) upExploreData()
|
||||
if (isActive) upExploreData(searchKey)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user