|
@@ -163,6 +163,40 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
addType<CommonSearchModel>(HOME_SEARCH_PROVIDER)
|
|
|
addType<CategoryModel>(HOME_CATEGORY_PROVIDER)
|
|
|
addType<FoodListModel>(HOME_FOOD_LIST_PROVIDER)
|
|
|
+ onCreate {
|
|
|
+ if (it == HOME_FOOD_LIST_PROVIDER){
|
|
|
+ foodRecycle = findView(R.id.food_recycle)
|
|
|
+
|
|
|
+ (foodRecycle?.itemAnimator as SimpleItemAnimator).supportsChangeAnimations =
|
|
|
+ false
|
|
|
+ foodRecycle?.setHasFixedSize(true)
|
|
|
+ foodRecycle?.isNestedScrollingEnabled = false
|
|
|
+ foodRecycle?.setRecycledViewPool(recycledViewPool)
|
|
|
+ foodRecycle?.grid(4)
|
|
|
+ foodRecycle?.setup {
|
|
|
+ setHasStableIds(true)
|
|
|
+ if (isNightTheme()) {
|
|
|
+ addType<FoodContentModel>(com.develop.common.R.layout.food_content_night_provider)
|
|
|
+ onBind {
|
|
|
+ findView<FoodContentView>(com.develop.common.R.id.food_content_view).setFoodContent(
|
|
|
+ getModel()
|
|
|
+ )
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ addType<FoodContentModel>(com.develop.common.R.layout.food_content_provider)
|
|
|
+ onBind {
|
|
|
+ findView<FoodContentView>(com.develop.common.R.id.food_content_view).setFoodContent(
|
|
|
+ getModel()
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ foodRecycle?.setRecyclerListener { holder ->
|
|
|
+ holder.itemView.findViewById<FoodContentView>(com.develop.common.R.id.food_content_view)
|
|
|
+ .recycleImageView()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
onBind {
|
|
|
when (itemViewType) {
|
|
|
HOME_TITLE_PROVIDER -> {
|
|
@@ -175,36 +209,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
|
|
|
HOME_FOOD_LIST_PROVIDER -> {
|
|
|
val models = getModel<FoodListModel>()
|
|
|
- foodRecycle = findView(R.id.food_recycle)
|
|
|
- (foodRecycle?.itemAnimator as SimpleItemAnimator).supportsChangeAnimations =
|
|
|
- false
|
|
|
- foodRecycle?.setHasFixedSize(true)
|
|
|
- foodRecycle?.isNestedScrollingEnabled = false
|
|
|
- foodRecycle?.setRecycledViewPool(recycledViewPool)
|
|
|
- foodRecycle?.grid(4)
|
|
|
- foodRecycle?.setup {
|
|
|
- if (isNightTheme()) {
|
|
|
- addType<FoodContentModel>(com.develop.common.R.layout.food_content_night_provider)
|
|
|
- onBind {
|
|
|
- findView<FoodContentView>(com.develop.common.R.id.food_content_view).setFoodContent(
|
|
|
- getModel()
|
|
|
- )
|
|
|
- }
|
|
|
- } else {
|
|
|
- addType<FoodContentModel>(com.develop.common.R.layout.food_content_provider)
|
|
|
- onBind {
|
|
|
- findView<FoodContentView>(com.develop.common.R.id.food_content_view).setFoodContent(
|
|
|
- getModel()
|
|
|
- )
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }?.models = models.foodList
|
|
|
- foodRecycle?.setRecyclerListener { holder ->
|
|
|
- holder.itemView.findViewById<FoodContentView>(com.develop.common.R.id.food_content_view)
|
|
|
- .recycleImageView()
|
|
|
- }
|
|
|
+ foodRecycle?.models = models.foodList
|
|
|
}
|
|
|
|
|
|
HOME_FUNCTION_PROVIDER -> {
|