|
@@ -87,11 +87,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
onBind {
|
|
onBind {
|
|
val model = getModel<DevRecipeCategory>()
|
|
val model = getModel<DevRecipeCategory>()
|
|
bindFilterSortView(
|
|
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)
|
|
findView<HomeFilterSortSearchView>(R.id.function_view)
|
|
if (filterSortModel != null) {
|
|
if (filterSortModel != null) {
|
|
filterSortSearchView?.apply {
|
|
filterSortSearchView?.apply {
|
|
- var size =
|
|
|
|
- viewModel.categorySizeList[viewModel.categoryCode]
|
|
|
|
|
|
+ var size = viewModel.categorySizeList[viewModel.categoryCode]
|
|
if (size == null) {
|
|
if (size == null) {
|
|
size = "0"
|
|
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(
|
|
findView<FoodContentView>(com.develop.common.R.id.food_content_view).setFoodContent(
|
|
getModel()
|
|
getModel()
|
|
)
|
|
)
|
|
@@ -308,8 +302,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
if (viewModel.isSearch) {
|
|
if (viewModel.isSearch) {
|
|
if (viewModel.recipesType == RecipesType.ONLINE) {
|
|
if (viewModel.recipesType == RecipesType.ONLINE) {
|
|
if (!viewModel.loadMoreOnLineSearchRecipeList(
|
|
if (!viewModel.loadMoreOnLineSearchRecipeList(
|
|
- currentHotWord,
|
|
|
|
- viewModel.lastSearchCategoryType
|
|
|
|
|
|
+ currentHotWord, viewModel.lastSearchCategoryType
|
|
)
|
|
)
|
|
) {
|
|
) {
|
|
finishLoadMoreWithNoMoreData()
|
|
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 {
|
|
private var hotWordsSelectedCallback = object : CommonSearchLayout.OnHotWordsSelectedListener {
|
|
override fun onHotWordsSelected(hotWord: String) {
|
|
override fun onHotWordsSelected(hotWord: String) {
|
|
@@ -666,11 +665,11 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
}
|
|
}
|
|
|
|
|
|
errorCallback.observe(viewLifecycleOwner) {
|
|
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()
|
|
loadingDialog.removeSelf()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -825,4 +824,10 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Subscribe
|
|
|
|
+ fun onHomeBackClickEvent(event: HomeActivity.HomeBackClickEvent) {
|
|
|
|
+ filterSortSearchView?.checkOnlineOrLocalRecipesView(true)
|
|
|
|
+ }
|
|
}
|
|
}
|