mirror of
https://github.com/gedoor/legado.git
synced 2024-07-06 23:47:49 +08:00
优化
This commit is contained in:
parent
3cc4fe9201
commit
b8939d534f
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user