فهرست منبع

提交人:jtm
提交内容:bug fixed

江天明 1 سال پیش
والد
کامیت
559dfe554b
1فایلهای تغییر یافته به همراه7 افزوده شده و 1 حذف شده
  1. 7 1
      BusinessMain/src/main/java/com/develop/main/ui/RecipesFragment.kt

+ 7 - 1
BusinessMain/src/main/java/com/develop/main/ui/RecipesFragment.kt

@@ -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()