|
@@ -60,6 +60,8 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
}
|
|
|
private var isRefresh = false
|
|
|
|
|
|
+ private var needRefresh = false
|
|
|
+
|
|
|
private val filterPopupWindow by lazy {
|
|
|
CommonPopupWindow.ViewBuilder<FilterSortViewLayout>().width(dp417).height(dp549)
|
|
|
.outsideTouchable(true).focusable(true).alpha(0.5f).clippingEnabled(false)
|
|
@@ -116,13 +118,16 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
override fun onPostCreateView() {
|
|
|
super.onPostCreateView()
|
|
|
initView()
|
|
|
+ needRefresh = true
|
|
|
initLiveDataCallback()
|
|
|
|
|
|
}
|
|
|
|
|
|
override fun onResume() {
|
|
|
super.onResume()
|
|
|
- refreshOnLineOrLocalRecipes()
|
|
|
+ if (needRefresh) {
|
|
|
+ refreshOnLineOrLocalRecipes()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
override fun onDestroy() {
|
|
@@ -402,6 +407,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
|
|
|
//获取对应分类菜谱回调
|
|
|
localRecipesLiveData.observe(viewLifecycleOwner) {
|
|
|
+ needRefresh = false
|
|
|
binding.page.apply {
|
|
|
if (isRefresh) {
|
|
|
finishRefresh()
|