An Android app designed to create and store recipes. It is written in Kotlin.
This app takes an approach similiar to the Model-View-Viewmodel architectural pattern to facilitate seperation of concerns. The main components are the UI, the Viewmodel, and the database abstraction layer.
The UI is is used for displaying views and capturing input. Data binding is used so that each xml layout has immediate access to the data it needs to display. The UI also observes changes in the the data to be displayed, via LiveData, and updates accordingly.
The Viewmodel is used for holding/trasforming the data the UI needs to display and handling the input that the UI caputres.
The database abstraction layer, implemented with the Room Persistence Library, stores all of the recipe information, and provides idiomatic database access via Data Access Objects (DAOs).
The following example demonstrates how these entities work together: the recipe Viewmodel uses the recipe DAO to get a LiveData list of recipes from the database, which the UI observes; upon observing a change to the list of recipes, the UI updates the views to include the changes.
Recime's database consists of three tables: recipes, ingredients, and instructions.
| id: Long | name: String | description: String | cookTimeEstimateInMinutes: Int | prepTimeEstimateInMinutes: Int | servings: Int | calories: Int |
|---|---|---|---|---|---|---|
| ... | ... | ... | ... |
| recipeId: Long | description: String | orderOfIngredient: Int |
|---|---|---|
| ... | ... | ... |
| recipeId: Long | description: String | orderOfInstruction: Int |
|---|---|---|
| ... | ... | ... |
My app architecture and room database implementation were inspired by Udacity's Developing Android Apps with Kotlin course.
