Calculate calories and nutrients in your meals using Gizee, an Android-based app powered by the Nutritionix API, and 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) course.
Check out the release page and download the latest APK.
- Kotlin, a modern, concise, and safe programming language recommended by Google.
- Architectural and design patterns:
- Clean architecture, which makes our apps highly testable and independent of any framework by separating the code into three layers: presentation, domain, and data.
- MVVM pattern, which handles how data is displayed to the user from the use case.
- Modular architecture, which makes features more independent, and each feature serves a clear purpose (including the use of dynamic-feature modules).
- Single-activity architecture, for a better user experience with a single activity.
- Android Jetpack, a set of libraries that simplify the code and focus on building a robust and useful app. Specifically, it includes:
- Coroutines Flow, used to handle streams of data asynchronously when fetching data from the network and local sources.
- Room, a robust database that provides an abstraction layer over SQLite.
- ViewModel, which persists UI state in a lifecycle-aware way.
- LiveData, which observes data changes in a lifecycle-aware way.
- Material Design 2, which provides the UI components and design guidelines.
- Third-party libraries:
- Retrofit, a REST client framework.
- Moshi, for parsing the JSON format.
- Koin, a dependency injection framework.
- Firebase Crashlytics, for real-time crash reporting.
- Firebase Analytics, which provides insights on app usage and user engagement.
- Chucker, an HTTP inspector.
- Timber, Logger, a logging utility.
- LeakCanary, for memory leak detection.
- OkHttp CertificatePinner, for certificate pinning.
- SQLCipher, for database encryption.
- AAChartCore, a data visualization chart framework.
- Coil, for image loading and caching.
- Facebook Shimmer, for a shimmering effect on loading screens.
- Lottie, for parsing animations natively.
- Tools:
- Android Studio, the official IDE for Android development.
- Figma, a design tool used to conceptualize the app and design the UI.
- CircleCI, for continuous integration and delivery.
- Resources:
- Feather Icons, Material Design Icons (Community), for all the icon needs throughout the app.
- LottieFiles, which provides free Lottie animations used for empty states.
- Freepik, which provides the illustrations displayed in the app.
First, clone this repository by executing the following command and then 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.
- 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/delete 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
You can specify a file path as either its absolute (full path) or relative path (short version). Learn more 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