diff --git a/app/app/src/main/java/tech/mercantec/easyeat/ui/dishes/DishesFragment.kt b/app/app/src/main/java/tech/mercantec/easyeat/ui/dishes/DishesFragment.kt index b80f99a..5d8d56a 100644 --- a/app/app/src/main/java/tech/mercantec/easyeat/ui/dishes/DishesFragment.kt +++ b/app/app/src/main/java/tech/mercantec/easyeat/ui/dishes/DishesFragment.kt @@ -68,7 +68,13 @@ class DishesFragment : Fragment() { return root } + fun DishesFragment.loadRecipes() { + binding.dishesList.visibility = View.GONE + binding.emptyDishesList.visibility = View.GONE + binding.addDish.visibility = View.GONE + binding.loading.visibility = View.VISIBLE + thread { val recipes: List try { @@ -85,6 +91,13 @@ class DishesFragment : Fragment() { } activity?.runOnUiThread { + binding.dishesList.visibility = View.VISIBLE + binding.emptyDishesList.visibility = View.VISIBLE + binding.addDish.visibility = View.VISIBLE + binding.loading.visibility = View.GONE + + binding.dishesList.emptyView = binding.emptyDishesList + val adapter = DishAdapter(requireContext(), dishes) { selectedDish -> // Open details activity val intent = Intent(requireContext(), DishDetailsActivity::class.java) diff --git a/app/app/src/main/res/layout/fragment_dishes.xml b/app/app/src/main/res/layout/fragment_dishes.xml index 62aca2f..0b80bf9 100644 --- a/app/app/src/main/res/layout/fragment_dishes.xml +++ b/app/app/src/main/res/layout/fragment_dishes.xml @@ -1,26 +1,47 @@ - - + + + android:dividerHeight="1dp" + /> + + - - + app:tint="@android:color/white" + /> + + diff --git a/app/app/src/main/res/values/strings.xml b/app/app/src/main/res/values/strings.xml index aca88ad..7dc3ec3 100644 --- a/app/app/src/main/res/values/strings.xml +++ b/app/app/src/main/res/values/strings.xml @@ -57,6 +57,7 @@ Increment portion count Decrement portion size Edit Recipe + You have not created any dishes yet g diff --git a/backend/API/BusinessLogic/RecipeLogic.cs b/backend/API/BusinessLogic/RecipeLogic.cs index a2533c9..075a0e8 100644 --- a/backend/API/BusinessLogic/RecipeLogic.cs +++ b/backend/API/BusinessLogic/RecipeLogic.cs @@ -21,7 +21,7 @@ namespace API.BusinessLogic public async Task GetRecipes(int userId) { var recipes = await _dbAccess.ReadRecipes(userId); - if (recipes == null || recipes.Count == 0) { return new ConflictObjectResult(new { message = "Could not find any recipes" }); } + if (recipes == null) { return new ConflictObjectResult(new { message = "Could not find any recipes" }); } var recipeDtos = recipes.Select(r => new GetAllRecipesDTO {