A simple multimodule app that fetches Food composition details from Calorie Ninja based on searches.
As a user, I can
- Search for a food to see it's composition
- Click on the search results to see more details
You'll need to provide API key to search the food composition from the API.
- Generate an API key from Calorie Ninja
- Create new file named -> local.properties in our project root folder
- Add the API key as shown below
key = <YOUR_API_KEY>
- Build the app
- Enjoyyyyy ๐
Initial Idle state | Idle state with recent searches | Search Results |
---|---|---|
Food details | Error State | No Results Found |
---|---|---|
core
data
- aggregates the data from the network and local database
domain
- handles business logic
local
- handles local caching
remote
- Fetches data from remote sources
testing
- Has utility classes used for testing
ui
- Has the app theming
feature
calories
- handles searching and displaying of the food composition
food details
- Displays the more food composition details
-
Tech Stack
- Kotlin - Programming language for Android development.
- Compose - modern toolkit for building native Android UI
- Kotlin coroutines - Executing code asynchronously.
- Flow - An asynchronous version of a Sequence, a type of collection whose values are lazily produced. Flow handles the stream of data asynchronously that executes sequentially.
- HILT - a dependency injection library for Android that reduces the boilerplate of doing manual dependency injection in your project.
- ViewModel - store and manage UI-related data in a lifecycle conscious way.
- Ktor Client - a multiplatform asynchronous HTTP client, which allows you to make requests and handle responses.
- Kotlin Serialization - Serialization/Desirialization of JSON response from network.
- Jetpack Datastore - a data storage solution that allows you to store key-value pairs.
-
Gradle
- Gradle Kotlin DSL - For reference purposes, here's an article explaining the migration.
- Plugins
- Ktlint - creates convenient tasks in your Gradle project that run ktlint checks or do code auto format.
-
CI/CD
- Github Actions
The app includes both unit and instrumented tests.
CalorieRepositoryTests |
---|
CaloriesSearchApiTest |
---|
CaloriesScreenViewModelTest |
---|
CaloriesScreenTest |
---|