|
@@ -85,7 +85,13 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
addType<DevRecipeCategory>(R.layout.item_filter_and_sort_view)
|
|
|
onBind {
|
|
|
val model = getModel<DevRecipeCategory>()
|
|
|
- bindFilterSortView(adapter, this, model.name ?: "", true)
|
|
|
+ bindFilterSortView(
|
|
|
+ adapter,
|
|
|
+ this,
|
|
|
+ model.name ?: "",
|
|
|
+ true,
|
|
|
+ model.number ?: ""
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
}?.models = categoryDataList
|
|
@@ -186,6 +192,8 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
findView<HomeFilterSortSearchView>(R.id.function_view)
|
|
|
if (filterSortModel != null) {
|
|
|
filterSortSearchView?.apply {
|
|
|
+ val size = viewModel.categorySizeList["all"]
|
|
|
+ updateFilterName(getString(com.develop.common.R.string.all) + "($size)")
|
|
|
setVisible()
|
|
|
if (!viewModel.isSearch) {
|
|
|
resetView()
|
|
@@ -415,7 +423,8 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
adapter: BindingAdapter,
|
|
|
binder: BindingAdapter.BindingViewHolder,
|
|
|
name: String,
|
|
|
- isFilter: Boolean
|
|
|
+ isFilter: Boolean,
|
|
|
+ categoryNum: String? = ""
|
|
|
) {
|
|
|
binder.apply {
|
|
|
val binding = ItemFilterAndSortViewBinding.bind(itemView)
|
|
@@ -424,7 +433,13 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
} else {
|
|
|
sortedSelectedPos
|
|
|
}
|
|
|
- binding.tvName.updateText(name)
|
|
|
+ if (isFilter) {
|
|
|
+ val size = viewModel.categorySizeList[categoryNum]
|
|
|
+ binding.tvName.updateText("$name($size)")
|
|
|
+ } else {
|
|
|
+ binding.tvName.updateText(name)
|
|
|
+ }
|
|
|
+
|
|
|
if (selectionPos == absoluteAdapterPosition) {
|
|
|
binding.tvName.text_color = checkedColor
|
|
|
binding.ivCheck.background_drawable = icChecked
|
|
@@ -471,7 +486,12 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
//默认All
|
|
|
categoryDataList.add(
|
|
|
0, DevRecipeCategory(
|
|
|
- "", "", getString(com.develop.common.R.string.all), null, null, null
|
|
|
+ "",
|
|
|
+ "all",
|
|
|
+ getString(com.develop.common.R.string.all),
|
|
|
+ null,
|
|
|
+ null,
|
|
|
+ null
|
|
|
)
|
|
|
)
|
|
|
if (lastSortedPos != 0) {
|
|
@@ -539,7 +559,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
categoryDataList = it
|
|
|
categoryDataList.add(
|
|
|
0, DevRecipeCategory(
|
|
|
- "", "", getString(com.develop.common.R.string.all), null, null, null
|
|
|
+ "", "all", getString(com.develop.common.R.string.all), null, null, null
|
|
|
)
|
|
|
)
|
|
|
if (currCategoryName.isNotEmpty()) {
|
|
@@ -558,7 +578,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
|
|
|
//获取线上热门标签回调
|
|
|
onLineHotTagsLiveData.observe(viewLifecycleOwner) {
|
|
|
- // binding.rv.models = DataFactory.genOnLineHotTags(it)
|
|
|
+ // binding.rv.models = DataFactory.genOnLineHotTags(it)
|
|
|
}
|
|
|
|
|
|
//搜索回调
|
|
@@ -586,8 +606,9 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
private fun updateCategoryName(devRecipeCategory: DevRecipeCategory) {
|
|
|
loadingDialog.showDialog(childFragmentManager, "loadingDialog")
|
|
|
viewModel.currCategoryName = devRecipeCategory.name ?: ""
|
|
|
+ val size = viewModel.categorySizeList[devRecipeCategory.number]
|
|
|
filterSortSearchView?.updateFilterName(
|
|
|
- viewModel.currCategoryName
|
|
|
+ viewModel.currCategoryName + "($size)"
|
|
|
)
|
|
|
if (viewModel.recipesType == RecipesType.ONLINE) {
|
|
|
viewModel.categoryCode = devRecipeCategory.code
|
|
@@ -597,7 +618,12 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
viewModel.categoryCode = devRecipeCategory.number.toString()
|
|
|
isRefresh = true
|
|
|
binding.page.resetNoMoreData()
|
|
|
- viewModel.queryLocalRecipes(viewModel.categoryCode)
|
|
|
+ if (viewModel.categoryCode == "all") {
|
|
|
+ viewModel.queryLocalRecipes("")
|
|
|
+ } else {
|
|
|
+ viewModel.queryLocalRecipes(viewModel.categoryCode)
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|