From 2c22f8d8e134bf83d824ab2e1a5b57f77d2278f6 Mon Sep 17 00:00:00 2001 From: LilleBRG <lillebrgmc@gmail.com> Date: Tue, 13 May 2025 15:38:11 +0200 Subject: [PATCH] more fixes idk --- app/app/src/main/java/tech/mercantec/easyeat/helpers/auth.kt | 2 +- app/app/src/main/java/tech/mercantec/easyeat/helpers/dishes.kt | 2 +- .../tech/mercantec/easyeat/ui/dishes/CreateDishActivity.kt | 3 --- .../tech/mercantec/easyeat/ui/dishes/DishDetailsActivity.kt | 2 +- .../java/tech/mercantec/easyeat/ui/dishes/DishesFragment.kt | 1 + .../tech/mercantec/easyeat/ui/dishes/GenerateRecipeActivity.kt | 2 +- app/app/src/main/res/layout/activity_dish_details.xml | 2 +- 7 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/app/src/main/java/tech/mercantec/easyeat/helpers/auth.kt b/app/app/src/main/java/tech/mercantec/easyeat/helpers/auth.kt index bb8cdce..5362641 100644 --- a/app/app/src/main/java/tech/mercantec/easyeat/helpers/auth.kt +++ b/app/app/src/main/java/tech/mercantec/easyeat/helpers/auth.kt @@ -124,5 +124,5 @@ data class ShoppingListAddRecipeRequest(val id: Int, val multiplier: Int) fun AddRecipeToShoppingList(ctx: Context, id: Int, multiplier: Int) { val request = ShoppingListAddRecipeRequest(id, multiplier) - return requestJson<ShoppingListAddRecipeRequest, Unit>(ctx, "ADD", "/api/ShoppingList/recipeadd", request) + return requestJson<ShoppingListAddRecipeRequest, Unit>(ctx, "POST", "/api/ShoppingList/recipeadd", request) } diff --git a/app/app/src/main/java/tech/mercantec/easyeat/helpers/dishes.kt b/app/app/src/main/java/tech/mercantec/easyeat/helpers/dishes.kt index 146e876..bcaba3a 100644 --- a/app/app/src/main/java/tech/mercantec/easyeat/helpers/dishes.kt +++ b/app/app/src/main/java/tech/mercantec/easyeat/helpers/dishes.kt @@ -19,7 +19,7 @@ fun createRecipe(ctx: Context, recipe: Recipe) { @Serializable data class GetAllRecipesResponse(val id: Int, val name: String, val description: String) -fun getAllRecipies(ctx: Context): List<GetAllRecipesResponse> { +fun getAllRecipes(ctx: Context): List<GetAllRecipesResponse> { return requestJson<Unit, List<GetAllRecipesResponse>>(ctx, "GET", "/api/Recipe/getall", null) } diff --git a/app/app/src/main/java/tech/mercantec/easyeat/ui/dishes/CreateDishActivity.kt b/app/app/src/main/java/tech/mercantec/easyeat/ui/dishes/CreateDishActivity.kt index 7743358..b5cf99f 100644 --- a/app/app/src/main/java/tech/mercantec/easyeat/ui/dishes/CreateDishActivity.kt +++ b/app/app/src/main/java/tech/mercantec/easyeat/ui/dishes/CreateDishActivity.kt @@ -15,9 +15,6 @@ import androidx.appcompat.app.AppCompatActivity import tech.mercantec.easyeat.R import tech.mercantec.easyeat.helpers.ApiRequestException import tech.mercantec.easyeat.helpers.createRecipe -import tech.mercantec.easyeat.helpers.request -import tech.mercantec.easyeat.models.CreateIngredient -import tech.mercantec.easyeat.models.CreateRecipe import tech.mercantec.easyeat.models.Ingredient import tech.mercantec.easyeat.models.Recipe import kotlin.concurrent.thread diff --git a/app/app/src/main/java/tech/mercantec/easyeat/ui/dishes/DishDetailsActivity.kt b/app/app/src/main/java/tech/mercantec/easyeat/ui/dishes/DishDetailsActivity.kt index 5c5f1f6..bfa9630 100644 --- a/app/app/src/main/java/tech/mercantec/easyeat/ui/dishes/DishDetailsActivity.kt +++ b/app/app/src/main/java/tech/mercantec/easyeat/ui/dishes/DishDetailsActivity.kt @@ -112,7 +112,7 @@ class DishDetailsActivity : AppCompatActivity() { // You can do the same for directions if needed } - val saveButton: Button = findViewById(R.id.saveDishButton) + val saveButton: Button = findViewById(R.id.addDishToShoppingList) saveButton.setOnClickListener { 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 70ab3fd..b80f99a 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 @@ -17,6 +17,7 @@ import tech.mercantec.easyeat.helpers.ApiRequestException import tech.mercantec.easyeat.helpers.GetAllRecipesResponse import tech.mercantec.easyeat.helpers.getAllRecipes import tech.mercantec.easyeat.models.DishListItem +import tech.mercantec.easyeat.models.Recipe import kotlin.concurrent.thread class DishesFragment : Fragment() { diff --git a/app/app/src/main/java/tech/mercantec/easyeat/ui/dishes/GenerateRecipeActivity.kt b/app/app/src/main/java/tech/mercantec/easyeat/ui/dishes/GenerateRecipeActivity.kt index 94523f1..b4fc843 100644 --- a/app/app/src/main/java/tech/mercantec/easyeat/ui/dishes/GenerateRecipeActivity.kt +++ b/app/app/src/main/java/tech/mercantec/easyeat/ui/dishes/GenerateRecipeActivity.kt @@ -27,7 +27,7 @@ class GenerateRecipeActivity : AppCompatActivity() { progressDialog.show() thread { - val response: GenerateRecipeResponse +// val response: GenerateRecipeResponse try { val recipe = generateRecipeWithAI(this, name, Locale.getDefault().displayLanguage) diff --git a/app/app/src/main/res/layout/activity_dish_details.xml b/app/app/src/main/res/layout/activity_dish_details.xml index d431ab4..088988f 100644 --- a/app/app/src/main/res/layout/activity_dish_details.xml +++ b/app/app/src/main/res/layout/activity_dish_details.xml @@ -86,7 +86,7 @@ android:layout_marginHorizontal="10sp"/> <Button - android:id="@+id/add_dish" + android:id="@+id/addDishToShoppingList" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"