Skip to content

Commit

Permalink
Add README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tonnymuchui committed Aug 9, 2023
1 parent 4c08788 commit 833388b
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 28 deletions.
151 changes: 150 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,150 @@
# RecipeApp
# Recipe! :food:

## DESCRIPTION

This is an Engaging Android Mobile Application for Culinary Enthusiasts. Experience the culinary exploration with our immersive Recipe Android mobile application. Immerse yourself in a world of flavors and culinary creativity as you embark on a journey through this crafted recipe app.

## FEATURES

This Application allows users to explore an extensive collection of recipes while offering the convenient functionality to curate a personalized list of their most cherished culinary creations.

- User can view **Comprehensive Recipe Insights**.
-
- User can **Add to favorite a recipe**.

- User can view **Video Tutorials** of recipes, giving users a visual guide to follow along.

- User can **View Offline Access to ensure users can access their saved recipes, even when they're not connected to the internet.**

- User can **Search** enabling users to easily find recipes.
-
<p align="center">
<img width="250" src="https://drive.google.com/file/d/1Jn_ExJfM0eBz9PDz9tMmzSxr31rpUJTw/view?usp=sharing" alt="video" />
<p>

## PRE-REQUISITES.

A couple of things to get you started:

1. Ensure you have [Kotlin](https://kotlinlang.org/) installed

A simple way to install Kotlin is using [sdkman](https://sdkman.io/).

Simply follow the instructions to have _sdkman_ installed and install Kotlin:

```bash
sdk install kotlin
```

2. [Gradle](https://gradle.org/)

Gradle is used as a build automation tool and can be installed with sdkman:

```bash
sdk install gradle
```

3. [Android SDK](https://developer.android.com/studio/)

Android SDK used to provide all the necessary developer tools to build, test, and debug apps for Android in Windows, Mac or Linux.

4. [Android Build Tools](https://developer.android.com/studio/releases/build-tools)

Android SDK build tools used to debug, build, run and test an Android application.

#### Screenshots

<p align="center">
<img align="left" width="250" src="Spec.md/home.jpg" alt="home" />
<img align="centre" width="250" src="Spec.md/search.jpg" alt="search" />
<img align="right" width="250" src="Spec.md/categories.jpg" alt="categories" />
<p>


## TECHNOLOGIES USED:

1. **[Retrofit](https://square.github.io/retrofit/)**
**Retrofit is a third party library used for sending and receiving HTTP-based network requests.**
2. **[Kotlin](https://kotlinlang.org/)**

**source language.**

3. **[Gradle](https://gradle.org/)**

**For dependency management and running tasks.**

4. **[Android SDK](https://developer.android.com/studio/)**

**For providing all the necessary developer tools to build, test, and debug Android applications on Windows, Mac or Linux.**

5. **[Android Build Tools](https://developer.android.com/studio/releases/build-tools)**

**For debugging, building, running and testing an Android applications.**

6. **[Themealdb](https://www.themealdb.com/api.php)**

The Meal DB is a comprehensive platform that delivers swift, dependable, and consolidated data APIs, catering to culinary enthusiasts and their exploration of diverse recipes.

The Meal DB API serves as a pivotal tool for fetching an array of recipe details, organized by various criteria including ingredients and meal categories. This data empowers users to seamlessly access and appreciate an extensive range of culinary creations.

7. **[Room database](https://developer.android.com/training/data-storage/room)**

**Was used to save users favorite meals recipes**

Room Database is a **SQL database**. It is a powerful tool for managing local data in Android apps.


## LIBRARIES TO NOTE.

1. **[Room Database](https://github.com/google/gson)**

- ** Room Database is a powerful tool for managing local data in Android apps.**

2. **[Retrofit](https://square.github.io/retrofit/)**

- Retrofit is a third party library used for sending and receiving HTTP-based network requests.

3. **[Glide](https://github.com/square/glide)**

- Picasso was used to display recipe photos.

- **Glide** is an image library for **Android**.It caters to image loading and processing. It simplifies the process of displaying images from external locations



## **SETUP/INSTALLATION!**


1. You will need **Internet connection**.

2. You need to get into the **themealdb**.

Link:-> ```https://github.com/tonnymuchui/RecipeApp```

3. From there you can access **RecipeApp**.

4. **Clone** the project.

5. **get into project folder** (cd into project).

6. If you have all the **Pre-requisites**

7. Open your **Android Studio Editor and run the Application**.


## How to contribute

All contributions are welcome, from code to documentation to graphics to design suggestions to bug reports. Please use GitHub to its fullest. Whatever you have to offer, we can use it!


## Support & Contact

- Mobile number: (+254) 721270949

- Email Address: [email protected]

- github-username: [tonnymuchui](https://github.com/tonnymuchui)

## LICENSE

This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.
Binary file added Spec.md/categories.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Spec.md/home.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Spec.md/search.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 37 additions & 24 deletions app/src/main/java/com/recipe/viewModel/HomeViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import javax.security.auth.callback.Callback

class HomeViewModel(
private var mealDatabase: MealDatabase
): ViewModel() {
) : ViewModel() {
private val randomMealLive = MutableLiveData<Meal>()
private var popularItemsMealLive = MutableLiveData<List<MealsByCategory>>()
private var categoryLiveData = MutableLiveData<List<Category>>()
Expand All @@ -39,46 +39,55 @@ class HomeViewModel(

override fun onResponse(call: Call<MealList>, response: Response<MealList>) {
if (response.body() != null) {
val randomMeal : Meal = response.body()!!.meals[0]
val randomMeal: Meal = response.body()!!.meals[0]
randomMealLive.value = randomMeal
} else return;
}
})
}

fun getPopularItems() {
RetrofitInstance.api.getPopularItems("Seafood").enqueue(object : retrofit2.Callback<MealsByCategoryList>{
override fun onResponse(call: Call<MealsByCategoryList>, response: Response<MealsByCategoryList>) {
if (response.body() !=null) {
popularItemsMealLive.value = response.body()!!.meals
RetrofitInstance.api.getPopularItems("Seafood")
.enqueue(object : retrofit2.Callback<MealsByCategoryList> {
override fun onResponse(
call: Call<MealsByCategoryList>,
response: Response<MealsByCategoryList>
) {
if (response.body() != null) {
popularItemsMealLive.value = response.body()!!.meals
}
}
}

override fun onFailure(call: Call<MealsByCategoryList>, t: Throwable) {
Log.d("Home Fragment", t.message.toString())
}
})
override fun onFailure(call: Call<MealsByCategoryList>, t: Throwable) {
Log.d("Home Fragment", t.message.toString())
}
})
}
fun observeRandomLiveData():LiveData<Meal> {

fun observeRandomLiveData(): LiveData<Meal> {
return randomMealLive
}
fun observePopularItemsLiveData():LiveData<List<MealsByCategory>>{

fun observePopularItemsLiveData(): LiveData<List<MealsByCategory>> {
return popularItemsMealLive
}

fun getCategories() {
RetrofitInstance.api.getCategories().enqueue(object : retrofit2.Callback<CategoryList>{
RetrofitInstance.api.getCategories().enqueue(object : retrofit2.Callback<CategoryList> {
override fun onResponse(call: Call<CategoryList>, response: Response<CategoryList>) {
if (response.body() !=null) {
categoryLiveData.value = response.body()!!.categories
}
if (response.body() != null) {
categoryLiveData.value = response.body()!!.categories
}
}

override fun onFailure(call: Call<CategoryList>, t: Throwable) {
Log.d("Home Fragment", t.message.toString())
}
})
}
fun getMealById(id:String) {
RetrofitInstance.api.getMealDetails(id).enqueue(object : retrofit2.Callback<MealList>{

fun getMealById(id: String) {
RetrofitInstance.api.getMealDetails(id).enqueue(object : retrofit2.Callback<MealList> {
override fun onResponse(call: Call<MealList>, response: Response<MealList>) {
val meal = response.body()?.meals?.first()
meal.let {
Expand All @@ -91,19 +100,22 @@ class HomeViewModel(
}
})
}

fun observeBottomSheetMeal(): LiveData<Meal> = bottomSheetLiveData
fun deleteMeal(meal: Meal) {
viewModelScope.launch {
mealDatabase.mealDao().delete(meal)
}
}

fun insertMeal(meal: Meal) {
viewModelScope.launch {
mealDatabase.mealDao().upsert(meal)
}
}

fun searchMeals(searchQuery: String) = RetrofitInstance.api.searchMeals(searchQuery).enqueue(
object : retrofit2.Callback<MealList>{
object : retrofit2.Callback<MealList> {
override fun onResponse(call: Call<MealList>, response: Response<MealList>) {
val mealList = response.body()?.meals
mealList?.let {
Expand All @@ -112,11 +124,12 @@ class HomeViewModel(
}

override fun onFailure(call: Call<MealList>, t: Throwable) {
Log.e("Search error", t.message.toString())
Log.e("Search error", t.message.toString())
}
}
)
fun observeSearchedMealsLiveData() : LiveData<List<Meal>> = searchMealsLiveData
fun observeCategoriesLiveData():LiveData<List<Category>> = categoryLiveData
fun observeFavoritesMealsLiveData():LiveData<List<Meal>> = favoritesMealsLiveData

fun observeSearchedMealsLiveData(): LiveData<List<Meal>> = searchMealsLiveData
fun observeCategoriesLiveData(): LiveData<List<Category>> = categoryLiveData
fun observeFavoritesMealsLiveData(): LiveData<List<Meal>> = favoritesMealsLiveData
}
6 changes: 3 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<string name="home">Home</string>
<string name="categories">Categories</string>
<string name="favorite">Favorite</string>
<string name="category">Category</string>
<string name="what_would_you_want_to_eat">What\'s Your Palate Pining For?</string>
<string name="over_popular_items">popular items</string>
<string name="category">Category Meals</string>
<string name="what_would_you_want_to_eat">Select Your Dish</string>
<string name="over_popular_items">popular Meals</string>
<string name="area">Area :</string>
<string name="like_button">Like button</string>
<string name="details_image">details image</string>
Expand Down

0 comments on commit 833388b

Please sign in to comment.