Add linked ingredients to recipe step (#177)

* Add Compose to app module

* Move Theme to ui module

* Add Coil image loader

* Use Compose for recipe screen

* Save instruction to ingredient relation to DB

* Display ingredients as server formats them

* Display linked ingredients under each step

* Fix ingredients padding

* Show recipe full screen

* Fix recipe screen UI issues

* Hide keyboard on recipe navigation

* Fix loading recipes from DB with no instructions or ingredients

* Add instructions section title

* Add ingredients section title

* Remove unused view holders
This commit is contained in:
Kirill Kamakin
2023-11-07 20:47:01 +01:00
committed by GitHub
parent 5ed1acb678
commit 941d45328e
46 changed files with 797 additions and 730 deletions

View File

@@ -2,6 +2,7 @@ package gq.kirmanak.mealient.database
import gq.kirmanak.mealient.database.recipe.entity.RecipeEntity
import gq.kirmanak.mealient.database.recipe.entity.RecipeIngredientEntity
import gq.kirmanak.mealient.database.recipe.entity.RecipeIngredientToInstructionEntity
import gq.kirmanak.mealient.database.recipe.entity.RecipeInstructionEntity
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
import gq.kirmanak.mealient.database.recipe.entity.RecipeWithSummaryAndIngredientsAndInstructions
@@ -34,13 +35,29 @@ val TEST_RECIPE_SUMMARY_ENTITIES =
listOf(CAKE_RECIPE_SUMMARY_ENTITY, PORRIDGE_RECIPE_SUMMARY_ENTITY)
val MIX_CAKE_RECIPE_INSTRUCTION_ENTITY = RecipeInstructionEntity(
id = "1",
recipeId = "1",
text = "Mix the ingredients",
title = "",
)
val BAKE_CAKE_RECIPE_INSTRUCTION_ENTITY = RecipeInstructionEntity(
id = "2",
recipeId = "1",
text = "Bake the ingredients",
title = "",
)
val MIX_SUGAR_RECIPE_INGREDIENT_INSTRUCTION_ENTITY = RecipeIngredientToInstructionEntity(
recipeId = "1",
ingredientId = "1",
instructionId = "1",
)
val MIX_BREAD_RECIPE_INGREDIENT_INSTRUCTION_ENTITY = RecipeIngredientToInstructionEntity(
recipeId = "1",
ingredientId = "3",
instructionId = "1",
)
val CAKE_RECIPE_ENTITY = RecipeEntity(
@@ -50,20 +67,24 @@ val CAKE_RECIPE_ENTITY = RecipeEntity(
)
val CAKE_SUGAR_RECIPE_INGREDIENT_ENTITY = RecipeIngredientEntity(
id = "1",
recipeId = "1",
note = "2 oz of white sugar",
quantity = 1.0,
unit = null,
food = null,
title = null,
display = "2 oz of white sugar",
title = "Sugar",
)
val CAKE_BREAD_RECIPE_INGREDIENT_ENTITY = RecipeIngredientEntity(
id = "3",
recipeId = "1",
note = "2 oz of white bread",
quantity = 1.0,
unit = null,
food = null,
display = "2 oz of white bread",
title = null,
)
@@ -78,6 +99,10 @@ val FULL_CAKE_INFO_ENTITY = RecipeWithSummaryAndIngredientsAndInstructions(
MIX_CAKE_RECIPE_INSTRUCTION_ENTITY,
BAKE_CAKE_RECIPE_INSTRUCTION_ENTITY,
),
recipeIngredientToInstructionEntity = listOf(
MIX_SUGAR_RECIPE_INGREDIENT_INSTRUCTION_ENTITY,
MIX_BREAD_RECIPE_INGREDIENT_INSTRUCTION_ENTITY
),
)
val PORRIDGE_RECIPE_ENTITY_FULL = RecipeEntity(
@@ -87,31 +112,39 @@ val PORRIDGE_RECIPE_ENTITY_FULL = RecipeEntity(
)
val PORRIDGE_MILK_RECIPE_INGREDIENT_ENTITY = RecipeIngredientEntity(
id = "1",
recipeId = "2",
note = "2 oz of white milk",
quantity = 1.0,
unit = null,
food = null,
display = "2 oz of white milk",
title = null,
)
val PORRIDGE_SUGAR_RECIPE_INGREDIENT_ENTITY = RecipeIngredientEntity(
id = "2",
recipeId = "2",
note = "2 oz of white sugar",
quantity = 1.0,
unit = null,
food = null,
title = null,
display = "2 oz of white sugar",
title = "Sugar",
)
val PORRIDGE_MIX_RECIPE_INSTRUCTION_ENTITY = RecipeInstructionEntity(
id = "1",
recipeId = "2",
text = "Mix the ingredients"
text = "Mix the ingredients",
title = "",
)
val PORRIDGE_BOIL_RECIPE_INSTRUCTION_ENTITY = RecipeInstructionEntity(
id = "2",
recipeId = "2",
text = "Boil the ingredients"
text = "Boil the ingredients",
title = "",
)
val FULL_PORRIDGE_INFO_ENTITY = RecipeWithSummaryAndIngredientsAndInstructions(
@@ -124,5 +157,6 @@ val FULL_PORRIDGE_INFO_ENTITY = RecipeWithSummaryAndIngredientsAndInstructions(
recipeInstructions = listOf(
PORRIDGE_MIX_RECIPE_INSTRUCTION_ENTITY,
PORRIDGE_BOIL_RECIPE_INSTRUCTION_ENTITY,
)
),
recipeIngredientToInstructionEntity = emptyList(),
)