|
@@ -21,6 +21,7 @@ import com.develop.base.ext.navigateTo
|
|
|
import com.develop.base.ext.resId2Dimension
|
|
|
import com.develop.base.ext.text_color
|
|
|
import com.develop.base.ext.updateText
|
|
|
+import com.develop.base.util.GlobalToast
|
|
|
import com.develop.base.widgets.CommonPopupWindow
|
|
|
import com.develop.common.data_repo.db.*
|
|
|
import com.develop.common.data_repo.db.entity.DevRecipeCategory
|
|
@@ -69,7 +70,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
|
|
|
}.onShowBefore { popupWindow, view ->
|
|
|
filterRv = view.findViewById(com.develop.common.R.id.filter_recycle)
|
|
|
- val triangle:View = view.findViewById(com.develop.common.R.id.triangle)
|
|
|
+ val triangle: View = view.findViewById(com.develop.common.R.id.triangle)
|
|
|
val param = triangle.layoutParams as RelativeLayout.LayoutParams
|
|
|
param.marginStart = dp65
|
|
|
triangle.layoutParams = param
|
|
@@ -93,7 +94,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
.intercept { popupWindow, view ->
|
|
|
|
|
|
}.onShowBefore { popupWindow, view ->
|
|
|
- val triangle:View = view.findViewById(com.develop.common.R.id.triangle)
|
|
|
+ val triangle: View = view.findViewById(com.develop.common.R.id.triangle)
|
|
|
val param = triangle.layoutParams as RelativeLayout.LayoutParams
|
|
|
param.addRule(RelativeLayout.CENTER_HORIZONTAL)
|
|
|
triangle.layoutParams = param
|
|
@@ -163,13 +164,14 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
onCreate {
|
|
|
if (it == HOME_FOOD_LIST_PROVIDER) {
|
|
|
foodRecycle = findView(R.id.food_recycle)
|
|
|
- (foodRecycle?.itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false
|
|
|
+ (foodRecycle?.itemAnimator as SimpleItemAnimator).supportsChangeAnimations =
|
|
|
+ false
|
|
|
foodRecycle?.setHasFixedSize(true)
|
|
|
foodRecycle?.isNestedScrollingEnabled = false
|
|
|
foodRecycle?.setRecycledViewPool(recycledViewPool)
|
|
|
foodRecycle?.grid(4)
|
|
|
foodRecycle?.setup {
|
|
|
- if (isNightTheme()){
|
|
|
+ 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(
|
|
@@ -280,7 +282,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (isNightTheme()){
|
|
|
+ if (isNightTheme()) {
|
|
|
binding.footer.apply {
|
|
|
setPrimaryColor(Color.parseColor("#1A1A1A"))
|
|
|
setFinishDuration(0)
|
|
@@ -483,13 +485,13 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
}
|
|
|
|
|
|
moreLocalRecipeLiveData.observe(viewLifecycleOwner) {
|
|
|
- binding.page.finishLoadMore(true)
|
|
|
- foodRecycle?.addModels(it)
|
|
|
+ binding.page.finishLoadMore(0)
|
|
|
+ foodRecycle?.addModels(it, false)
|
|
|
}
|
|
|
|
|
|
moreSearchLocalRecipeLiveData.observe(viewLifecycleOwner) {
|
|
|
- binding.page.finishLoadMore(true)
|
|
|
- foodRecycle?.addModels(it)
|
|
|
+ binding.page.finishLoadMore(0)
|
|
|
+ foodRecycle?.addModels(it, false)
|
|
|
}
|
|
|
|
|
|
//获取线上分类回调
|
|
@@ -523,6 +525,10 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
|
|
|
}
|
|
|
loadingDialog.removeSelf()
|
|
|
}
|
|
|
+ errorCallback.observe(viewLifecycleOwner){
|
|
|
+ GlobalToast.showToast("network error")
|
|
|
+ loadingDialog.removeSelf()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|