|
@@ -418,51 +418,33 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
updateCategoryName(categoryDataList[0])
|
|
|
updateSortName(0, false)
|
|
|
filterRv?.models = categoryDataList
|
|
|
- binding.rv.scrollToPosition(0)
|
|
|
}
|
|
|
|
|
|
//获取对应分类菜谱回调
|
|
|
localRecipesLiveData.observe(viewLifecycleOwner) {
|
|
|
needRefresh = false
|
|
|
- binding.page.apply {
|
|
|
- if (isRefresh) {
|
|
|
- finishRefresh()
|
|
|
- } else {
|
|
|
- finishLoadMore(true)
|
|
|
- }
|
|
|
- }
|
|
|
+ binding.page.finishRefresh()
|
|
|
binding.rv.apply {
|
|
|
models = it
|
|
|
- if (isRefresh) {
|
|
|
- scrollToPosition(0)
|
|
|
- }
|
|
|
+ scrollToPosition(0)
|
|
|
}
|
|
|
- if (isRefresh) {
|
|
|
- scopeNet {
|
|
|
- delay(300)
|
|
|
- loadingDialog.removeSelf()
|
|
|
- }
|
|
|
- } else {
|
|
|
+ scopeNet {
|
|
|
+ delay(300)
|
|
|
loadingDialog.removeSelf()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//获取线上菜谱列表回调
|
|
|
onLineRecipesLiveData.observe(viewLifecycleOwner) {
|
|
|
- binding.page.apply {
|
|
|
- if (isRefresh) {
|
|
|
- finishRefresh()
|
|
|
- } else {
|
|
|
- finishLoadMore(true)
|
|
|
- }
|
|
|
- }
|
|
|
+ binding.page.finishRefresh()
|
|
|
binding.rv.apply {
|
|
|
models = it
|
|
|
- if (isRefresh) {
|
|
|
- scrollToPosition(0)
|
|
|
- }
|
|
|
+ scrollToPosition(0)
|
|
|
+ }
|
|
|
+ scopeNet {
|
|
|
+ delay(300)
|
|
|
+ loadingDialog.removeSelf()
|
|
|
}
|
|
|
- loadingDialog.removeSelf()
|
|
|
}
|
|
|
|
|
|
moreLocalRecipeLiveData.observe(viewLifecycleOwner) {
|
|
@@ -497,13 +479,10 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
//搜索回调
|
|
|
hotWordSearchRecipesLiveData.observe(viewLifecycleOwner) {
|
|
|
binding.page.apply {
|
|
|
- if (isRefresh) {
|
|
|
- finishRefresh()
|
|
|
- } else {
|
|
|
- finishLoadMore(true)
|
|
|
- }
|
|
|
+ finishRefresh()
|
|
|
}
|
|
|
binding.rv.models = it
|
|
|
+ binding.rv.scrollToPosition(0)
|
|
|
loadingDialog.removeSelf()
|
|
|
}
|
|
|
}
|
|
@@ -523,7 +502,8 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
viewModel.getOnLineRecipeList(categoryCode, "")
|
|
|
} else {
|
|
|
categoryCode = devRecipeCategory.number.toString()
|
|
|
-
|
|
|
+ isRefresh = true
|
|
|
+ binding.page.resetNoMoreData()
|
|
|
viewModel.queryLocalRecipes(categoryCode)
|
|
|
}
|
|
|
}
|
|
@@ -559,6 +539,8 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
if (viewModel.recipesType == RecipesType.ONLINE) {
|
|
|
viewModel.getOnLineRecipeList(categoryCode, "")
|
|
|
} else {
|
|
|
+ isRefresh = true
|
|
|
+ binding.page.resetNoMoreData()
|
|
|
viewModel.queryLocalRecipes(categoryCode)
|
|
|
}
|
|
|
}
|