|
@@ -87,11 +87,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
onBind {
|
|
|
val model = getModel<DevRecipeCategory>()
|
|
|
bindFilterSortView(
|
|
|
- adapter,
|
|
|
- this,
|
|
|
- model.name ?: "",
|
|
|
- true,
|
|
|
- model.number ?: "0"
|
|
|
+ adapter, this, model.name ?: "", true, model.number ?: "0"
|
|
|
)
|
|
|
}
|
|
|
}
|
|
@@ -193,8 +189,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
findView<HomeFilterSortSearchView>(R.id.function_view)
|
|
|
if (filterSortModel != null) {
|
|
|
filterSortSearchView?.apply {
|
|
|
- var size =
|
|
|
- viewModel.categorySizeList[viewModel.categoryCode]
|
|
|
+ var size = viewModel.categorySizeList[viewModel.categoryCode]
|
|
|
if (size == null) {
|
|
|
size = "0"
|
|
|
}
|
|
@@ -265,8 +260,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
|
|
|
}
|
|
|
|
|
|
- com.develop.common.R.layout.food_content_night_provider,
|
|
|
- com.develop.common.R.layout.food_content_provider -> {
|
|
|
+ com.develop.common.R.layout.food_content_night_provider, com.develop.common.R.layout.food_content_provider -> {
|
|
|
findView<FoodContentView>(com.develop.common.R.id.food_content_view).setFoodContent(
|
|
|
getModel()
|
|
|
)
|
|
@@ -308,8 +302,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
if (viewModel.isSearch) {
|
|
|
if (viewModel.recipesType == RecipesType.ONLINE) {
|
|
|
if (!viewModel.loadMoreOnLineSearchRecipeList(
|
|
|
- currentHotWord,
|
|
|
- viewModel.lastSearchCategoryType
|
|
|
+ currentHotWord, viewModel.lastSearchCategoryType
|
|
|
)
|
|
|
) {
|
|
|
finishLoadMoreWithNoMoreData()
|
|
@@ -406,8 +399,14 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ override fun onLocalRecipesClick() {
|
|
|
+ EventBus.getDefault().post(OnLocalRecipesEvent())
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+ class OnLocalRecipesEvent {}
|
|
|
+
|
|
|
/**热词选择回调 */
|
|
|
private var hotWordsSelectedCallback = object : CommonSearchLayout.OnHotWordsSelectedListener {
|
|
|
override fun onHotWordsSelected(hotWord: String) {
|
|
@@ -666,11 +665,11 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
}
|
|
|
|
|
|
errorCallback.observe(viewLifecycleOwner) {
|
|
|
- if (!NetworkUtils.isWifiConnected()){
|
|
|
- GlobalToast.showToast(getString(com.develop.common.R.string.network_error))
|
|
|
- } else {
|
|
|
- GlobalToast.showToast(it)
|
|
|
- }
|
|
|
+ if (!NetworkUtils.isWifiConnected()) {
|
|
|
+ GlobalToast.showToast(getString(com.develop.common.R.string.network_error))
|
|
|
+ } else {
|
|
|
+ GlobalToast.showToast(it)
|
|
|
+ }
|
|
|
loadingDialog.removeSelf()
|
|
|
}
|
|
|
}
|
|
@@ -825,4 +824,10 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Subscribe
|
|
|
+ fun onHomeBackClickEvent(event: HomeActivity.HomeBackClickEvent) {
|
|
|
+ filterSortSearchView?.checkOnlineOrLocalRecipesView(true)
|
|
|
+ }
|
|
|
}
|