Calculate calories and nutrients in your meals using Gizee. This Android-based app is powered by Nutritionix API and entirely well-written in Kotlin. Gizee is built using Clean Architecture which makes it robust, flexible, and maintainable. This app was developed as a capstone project in Dicoding's Become an Android Developer Expert (Menjadi Android Developer Expert) class.
Check out the release page and download the latest apk.
- Kotlin, modern, concise, and safe programming language, recommended by Google.
- Architectural and design patterns:
- Clean architecture, makes our apps highly testable and independent of any framework by separating the code into three layers, such as presentation, domain, and data.
- MVVM pattern, handles how data is displayed to the user from the use case.
- Modular architecture, makes features more independent and each feature serves a clear purpose (including the use of dynamic-feature).
- Single-activity architecture, better user experience with a single activity.
- Android Jetpack, a set of libraries to simplify the code and focus on building a robust and useful app, specifically:
- Coroutines Flow, handle streams of data asynchronously used when fetching data from the network and local.
- Room, a robust database that provides an abstraction layer over the SQLite.
- ViewModel, persists UI state in a lifecycle-aware way.
- LiveData, observes data changes in a lifecycle-aware way.
- Material Design 2, provides the UI components and the design guidelines.
- Third-party libraries:
- Retrofit, REST client framework.
- Moshi, parsing the JSON format.
- Koin, dependency injection framework.
- Firebase Crashlytics, real-time crash reporter.
- Firebase Analytics, provides insight on app usage and user engagement.
- Chucker, HTTP inspector.
- Timber, Logger, logging utility.
- LeakCanary, memory leak detection.
- OkHttp CertificatePinner, certificate pinning.
- SQLCipher, database encryption.
- AAChartCore, data visualization chart framework.
- Coil, image loading and caching.
- Facebook Shimmer, shimmering effect on loading screen.
- Lottie, parsing animation natively.
- Tools:
- Android Studio, the official IDE for Android development.
- Figma, a design tool used to develop the app descriptions and design the UI.
- CircleCI, the continuous integration & delivery tools.
- Resources:
- Feather Icons, Material Design Icons (Community), provides all the icon needs throughout the app.
- LottieFiles, provides free Lottie animations used for empty history and empty favorites.
- Freepik, provides the illustration on the homepage.
Firstly, clone this repository and import it into Android Studio (git clone https://github.com/ariefzuhri/Gizee.git
).
- Get your Nutritionix API app id and app key.
- Create a new file named
secrets.properties
in the project root directory. - Put your app id and key in
secrets.properties
file by adding the following lines:
NUTRITIONIX_APP_ID=YOUR_APP_ID
NUTRITIONIX_APP_KEY=YOUR_APP_KEY
To set up Crashlytics, you just need to register this app with the Firebase Project.
- Open the Firebase Console and click Add project (or select your existing Firebase project).
- When creating a new Firebase project, just follow the instructions and keep the Enable Google Analytics for this project option switched on.
- When using an existing Firebase project, ensure that Google Analytics is enabled (see the instructions in number 2 here).
- In Project Overview, click Add app button and select the Android icon to register your Android app.
- Make sure the Android package name matches your app ID in the Android Studio project and you are not required to include the Debug signing certificate SHA-1.
- Download the
google-services.json
file and move it into Android app module root directory (./app
). - Skip the third step about Add Firebase SDK as the project already has the dependencies.
- Open the
secrets.properties
file. - Add the following new lines (you can get the public key hashes here):
NUTRITIONIX_BASE_URL=https://trackapi.nutritionix.com/v2/
NUTRITIONIX_PUBLIC_KEY_1=fajdlzqjFkH3fU8/NrjW0d4cFANUzh/4HstyvlVaTqM=
NUTRITIONIX_PUBLIC_KEY_2=JSMzqOOrtyOT1kmau6zKhgT676hGgczD5VMdRMyJZFA=
NUTRITIONIX_PUBLIC_KEY_3=++MBgDH5WGvL9Bcn5Be30cRcL0f5O+NyoXuWtQdX1aI=
NUTRITIONIX_PUBLIC_KEY_4=KwccWaCgrnaw6tsrrSO61FgLacNgG2MMLq8GE6+oP5I=
- Open the
secrets.properties
file. - Add the following new line:
DATABASE_PASSPHRASE=YOUR_ANY_PASSPHRASE
- You need to fork this project first before setting up your own CircleCI environment.
- After that, register or connect your CircleCI account with GitHub.
- Follow the instructions here to set it up. In step number 2, select Fastest instead of Fast.
- Set all environment variables in project settings. You can see how to make it works here. The environment variables include all variables defined in
secrets.properties
file plus the following 2 variables:
DEBUG_KEYSTORE={your own default debug.keystore file encoded in base64}
GOOGLE_SERVICES={your own google-services.json file encoded in base64}
To encode files in base64 you can use OpenSSL by downloading from here (the light version is sufficient) and see how to run the command here.
This step is optional for learning purposes. Since we don't need to publish the app to Google Play, you may skip this step and comment/remove the signing configuration in the app-level build.gradle.
- First, you need your own keystore. If you don't already have one, you can read how to create it here.
- Open the
secrets.properties
file and add the following lines:
STORE_FILE=YOUR_KEYSTORE_PATH
STORE_PASSWORD=YOUR_STORE_PASSWORD
KEY_ALIAS=_YOUR KEY_ALIAS
KEY_PASSWORD=YOUR_KEY_PASSWORD
To specify a file path, you can write its absolute (the full path) or just its relative path (the short version). See the details here.
Any contributions, issues, and feature requests are welcome.
Give a ⭐️ if you like this project.
This project is licensed under the MIT License. See the LICENSE
file for details.
- — on CSS Nutrition Facts Label
- Android Open Source Project on NestedScrollableHost
- Arman Rokni on Spaceship Empty Searching
- Ehsan on Empty State – Heart
- Igor Wojda on Multiple Ways of Defining Clean Architecture Layers
- pch.vector on diet composition illustration
- Ravi Tamada on Android Working with Bottom Sheet
- Yuichi Fujiki on How to Store/Use Sensitive Information in Android Development