Android project for Codepath
Jonathan Lin - 1st Tab: Random Recipe Screen
Michael Alvarez - 2nd Tab: Search Recipe by Keyword/Ingredient Screen
Alexandra Ernest - 3rd Tab: Find Recipe by Category Screen
Jimmy Wu - 4th Tab: Favorites Screen
Isaac Anzures - Recipe Screen
A recipe app for searching, viewing, and saving recipes.
[Evaluation of your app across the following attributes]
Required Must-have Stories
Bottom Navigation Bar (4 Tabs)
Flow Navigation (Screen to Screen)
Figma link: https://www.figma.com/file/OBT1KtDpdZsgEIyyqdFPRy/RecipeApp?node-id=0%3A1
[BONUS] Interactive Prototype
Property | Type | Description |
---|---|---|
favoriteIdDB | String | generated column id for the favorited recipe in database (favorites tab) |
recipeIdDB | String | id of a favorited recipe stored in database that will be used to access it's recipe screen. |
titleDB | String | title of favorited recipe stored in database |
imageDB | image | link of favorited recipe's image stored in database |
recipeId | String | id of recipe that will be used in api's url |
Base URL - https://api.spoonacular.com
HTTP Verb | Endpoint | Description |
---|---|---|
GET |
/recipes/findByIngredients | gets recipes that contain the ingredients |
GET |
/recipes/complexSearch | gets recipes that contain included parameters (keywords) |
GET |
/recipes/{id}/information | gets information and instructions of the recipe by id |
GET |
/recipes/informationBulk?ids={} | gets information and isntructions of recipes by ids |
GET |
/recipes/random?number={}&tags={} | gets list of random recipes by number and tag |
Home Screen (random recipe)
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/random?tags=vegetarian%2Cdessert&number=1")
.setHeader("x-rapidapi-host", "spoonacular-recipe-food-nutrition-v1.p.rapidapi.com")
.setHeader("x-rapidapi-key", "SIGN-UP-FOR-KEY")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
- (Create/POST) Save to Favorites list
- (Delete) Remove from Favorites list
Find Recipe Screen (search by recipe keyword/ingredient)
(Read/GET) Find recipes that use as many of the given ingredients as possible and have as little as possible missing ingredients.
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "https://spoonacular-recipe-food-nutrition- v1.p.rapidapi.com/recipes/findByIngredients?ingredients=apples%2Cflour%2Csugar&number=5&ignorePantry=true&ranking=1")
.setHeader("x-rapidapi-host", "spoonacular-recipe-food-nutrition-v1.p.rapidapi.com")
.setHeader("x-rapidapi-key", "SIGN-UP-FOR-KEY")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
Find Recipe Screen (search by food/recipe category)
(Read/GET) Find a recipe that is under a specific category
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/searchComplex?limitLicense=%3CREQUIRED%3E&offset=0&number=10&minIron=0&minCalcium=0&maxVitaminB2=1000&maxMagnesium=1000&minPotassium=0&maxVitaminB6=1000&intolerances=peanut%2C%20shellfish&maxVitaminB5=1000&minFolicAcid=0&minVitaminA=0&maxSodium=1000&maxSugar=1000&maxVitaminA=5000&maxFluoride=1000&minFluoride=0&minVitaminB1=0&minCholine=0&ranking=2&minFat=5&maxVitaminB1=1000&minVitaminB12=0&maxSelenium=1000&minZinc=0&minFolate=0&maxManganese=1000&maxVitaminB12=1000&maxPotassium=1000&maxIron=1000&minSelenium=0&minVitaminK=0&maxFiber=1000&minSodium=0&maxCopper=1000&minCalories=150&maxCholine=1000&minCholesterol=0&maxVitaminE=1000&minProtein=5&minVitaminB3=0&minVitaminB6=0&maxIodine=1000&excludeIngredients=coconut%2C%20mango&maxProtein=100&minMagnesium=0&minCarbs=5&cuisine=american&maxCaffeine=1000&maxSaturatedFat=50&maxVitaminK=1000&minAlcohol=0&minIodine=0&query=burger&minSaturatedFat=0&includeIngredients=onions%2C%20lettuce%2C%20tomato&minVitaminE=0&maxCalcium=1000&minFiber=0&minVitaminC=0&maxZinc=1000&maxCalories=1500&maxAlcohol=1000&minPhosphorus=0&minVitaminD=0&minVitaminB2=0&minSugar=0&maxFolate=1000&type=main%20course&maxCholesterol=1000&maxVitaminB3=1000&minCaffeine=0&minVitaminB5=0&maxFolicAcid=1000&maxCarbs=100&maxVitaminD=1000&equipment=pan&maxFat=100&minCopper=0&maxVitaminC=1000&maxPhosphorus=1000&minManganese=0")
.setHeader("x-rapidapi-host", "spoonacular-recipe-food-nutrition-v1.p.rapidapi.com")
.setHeader("x-rapidapi-key", "SIGN-UP-FOR-KEY")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
Recipe Screen (Displays information about the recipe such as name, description, ingredients, instructions, etc)
(Read/GET) Get recipe information such as name, description, ingredients, instructions, images, etc from the endpoint, /recipes/{id}/information and replacing the {id} with the passed String id. Use codepath's Async Http Client library to access and parse the json.
String recipeId = getArguments().getString("Bundle Key");
String recipe_API = "https://api.spoonacular.com/recipes/recipeId/information?apiKey=YOUR-API-KEY&includeNutrition=true";
AsyncHttpClient client = new AsyncHttpClient();
client.get(recipe_API, new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Headers headers, JSON json) {
Log.d(TAG, "onSuccess");
JSONObject jsonObject = json.jsonObject;
String testing = "";
try {
/*
Parse information from the json and put them into textviews.
/*
} catch (JSONException e) {
Log.e(TAG, "Hit json exception", e);
e.printStackTrace();
}
}
@Override
public void onFailure(int statusCode, Headers headers, String response, Throwable throwable) {
Log.d(TAG, "onFailure");
}
});
Favorites Screen (list of favorited recipes)
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
......
holder.favoritesLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AppCompatActivity activity = (AppCompatActivity) view.getContext();
RecipeFragment fragment = new RecipeFragment();
//using bundle to pass data to another fragment
Bundle args = new Bundle();
//key, value
args.putString("RecipeId", String.valueOf(recipeIdDB.get(position)));
fragment.setArguments(args);
//add a stack so we can click back button to go back to favorites fragment (add function in mainactivity to pop stack)
activity.getSupportFragmentManager().beginTransaction().replace(R.id.flContainer, fragment).addToBackStack(null).commit();
}
});
}
[Add list of network requests by screen ]
[Create basic snippets for each Parse network request]
1st tab:
2nd tab:
3rd tab:
4th tab: Favorites Screen:
Recipe Screen:
4th tab: Favorites Screen:
4th tab: Favorites Screen:
4th tab: Favorites Screen: