Procházet zdrojové kódy

提交人:jtm
提交内容:搜索崩溃问题

江天明 před 2 roky
rodič
revize
e573b19c2a

+ 5 - 0
BusinessMain/src/main/java/com/develop/main/ui/RecipesFragment.kt

@@ -129,6 +129,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
                 addType<CommonSearchModel>(HOME_SEARCH_PROVIDER)
                 addType<CategoryModel>(HOME_CATEGORY_PROVIDER)
                 addType<FoodListModel>(HOME_FOOD_LIST_PROVIDER)
+                addType<FoodContentModel>(com.develop.common.R.layout.food_content_provider)
                 onBind {
                     when (itemViewType) {
                         HOME_TITLE_PROVIDER -> {
@@ -185,6 +186,10 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
             setEnableRefresh(false)
             setOnLoadMoreListener {
                 isRefresh = false
+                if (viewModel.isSearch) {
+                    finishLoadMore(0)
+                    return@setOnLoadMoreListener
+                }
                 if (viewModel.recipesType == RecipesType.ONLINE) {
                     if (viewModel.currentPage < viewModel.totalPageSize) {
                         viewModel.getOnLineRecipeList(

+ 5 - 3
BusinessMain/src/main/java/com/develop/main/viewmodel/HomeViewModel.kt

@@ -141,10 +141,11 @@ class HomeViewModel : BaseViewModel() {
             allList.addAll(recipesList)
             allList.addAll(foodList)
             result.add(CategoryModel(recipeCount + foodCount, recipeCount, foodCount))
+            val foodContentList = mutableListOf<FoodContentModel>()
             when (categoryType) {
                 CategoryType.All -> {
                     allList.forEach {
-                        result.add(
+                        foodContentList.add(
                             FoodContentModel(
                                 it.photoPath ?: "",
                                 it.name ?: "",
@@ -158,7 +159,7 @@ class HomeViewModel : BaseViewModel() {
                 }
                 CategoryType.Recipes -> {
                     recipesList.forEach {
-                        result.add(
+                        foodContentList.add(
                             FoodContentModel(
                                 it.photoPath ?: "",
                                 it.name ?: "",
@@ -172,7 +173,7 @@ class HomeViewModel : BaseViewModel() {
                 }
                 CategoryType.Ingredients -> {
                     foodList.forEach {
-                        result.add(
+                        foodContentList.add(
                             FoodContentModel(
                                 it.photoPath ?: "",
                                 it.name ?: "",
@@ -185,6 +186,7 @@ class HomeViewModel : BaseViewModel() {
                     }
                 }
             }
+            result.add(FoodListModel(foodContentList,""))
             hotWordSearchRecipesLiveData.postValue(result)
         }
     }

+ 0 - 1
BusinessSetting/src/main/java/com/develop/setting/ui/WifiListActivity.kt

@@ -130,7 +130,6 @@ class WifiListActivity : CommonBindingActivity<ActivityWifiListBinding>() {
 
         wifiHelp = WifiHelp.Build(this).setErrorAuthenticating {
             dismissPlainDialog()
-            GlobalToast.showToast("failed to connect")
         }.setScanCallback {
             it?.apply {
                 wifiDataList.clear()