ITIS/ITCS 5180 Mobile Application Development Homework 04 solved

$35.00

Category: You will receive a download link of the .ZIP file upon Payment

Description

5/5 - (1 vote)

Homework 04 (100 Points)
In this assignment you will revisit “RecipePuppy recipe finder” app. The App displays
recipes from Recipe Puppy (http://www.recipepuppy.com/). This allows you to search
the recipes of the dish you are interested in, with proper ingredients. In this assignment,
you will learn how to use fragments instead of multiple activities.
The base URL of the API is: http://www.recipepuppy.com/api/?i=&q=. An example URL is: http://
www.recipepuppy.com/api/?i=onions,garlic&q=omelet .
You can load the URL in codebeautify.org/jsonviewer for better understanding of
JSON you receive.
In this assignment we will build two fragments. The first screen is to search, and the
second screen is to display the results of the recipe search.
Search Screen (40 Points)
You need to implement the following:
1. An EditText to put the dish name.
2. A scrollable add ingredients panel which can add up to 5 ingredients in total.
Page 2 of 3
(a)Search Screen (b) Added a list of
ingredients
(c) Loading recipes (d) Display recipes
Figure 1, App Wireframe
Recipe Puppy
Search
Dish
Add Ingredients
Recipes
Title: Monterey Turkey Omelet
Ingredients:
butter, eggs, garlic, green pepper, monterey
jack cheese, icons, turkey, water
URL: http://allrecipes.com/recipe/116899/
monterey-turkey-omelet/
Finish
Recipes
Loading…
Recipe Puppy
Search
Dish
Add Ingredients
Omelet
Onions
Garlic
3. The panel to add ingredients should be implemented using RecyclerView, see figure
1 (b).
4. It should display an empty EditText, and a floating action Add button. Once, you add
one ingredient, the floating action button should be changed from Add to Remove
button. Follow figure 1(b).
5. Then you need to create the URL as: http://www.recipepuppy.com/api/?
i=&q=.
6. There should be a Search button. Clicking on that button should take you to the
Display recipes screen where it displays a list of recipes.
Recipes Screen (60 Points)
1. Use an AsyncTask or Thread pool to communicate with the RecipePuppy api and to
parse the result. Do not use the main thread to parse them.
2. In our example, we wanted to search for a Omelet recipe having two key ingredients:
Onions, and Garlic.
3. In received JSON, you will find that there are two levels of the hierarchy. Inside
“array”, you will find “results”. You need to parse all the items in results.
4. Use AsyncTask or Thread pool to retrieve and parse it.
5. You need to implement a ProgressBar to display the progress while it is parsing, see
figure 1(c). You can do it using a different fragment.
6. Finally display your result. Please follow the instructions:
• The whole list of results should be displayed in a horizontal Recycler/CardView.
• You have four things to display in each item:
• Title (“title” in JSON)
• Recipe image (“thumbnail” in JSON)
• Ingredients (“ingredients” in JSON)
• URL (“href” in JSON)
• You need to use a separate AsyncTask when you load the image. Alternatively, you
can use Picasso library to load the image. (http://square.github.io/picasso/).
• The URL should be clickable, use implicit intents to open it in browsers.
• f no recipe is found, return to the main screen and toast to report that there were no
recipes found.
• Clicking on Finish button should Finish the second screen and return you to the
main screen.
7. Do not use the default Back Button options, override the method to use the
BackStack.
Page 3 of 3