Skip to content

A project to display nutrition information for different foods

Notifications You must be signed in to change notification settings

ndiritumichael/CalorieBytez

Repository files navigation

CalorieBytez App

This is a simple Android app that uses the Calorie Ninja to display nutritional data for various food items.

Pre-requisites

  • Built on A.S JellyFish
  • JDK 17
  • Access token from CalorieNinja.
  • Once received place it in the local.properties file as follows:
API_KEY = YourKey

To Inject the Key when using CI/CD with github actions , add the key to your projects secrets and extract in to your build workflow:

                  - name: Get local.properties from secrets
                    run: echo "${{secrets.LOCAL_PROPERTIES }}" > $GITHUB_WORKSPACE/local.properties

Architecture

This project uses a modularized approach using MVVM with Clean architecture which has the following advantages

  • Loose coupling between the code - The code can easily be modified without affecting any or a large part of the app's codebase thus easier to scale the application later on.
  • Easier to test code.
  • Separation of Concern - Different modules have specific responsibilities making it easier for modification and maintenance.

Modularization Structure

  • core
    • data
      • aggregates the data from the network and local database
    • network
      • handles getting data from any server/remote source
    • database
      • handles getting cached device data
  • domain
    • defines the core business logic for reuse
  • app
    • handles Ui logic of the app i.e navigation and use of the bottom bar.
  • feature
    • Search
      • handles displaying data of queried item combinations
    • Food Details
      • handles displaying all food nutritional details
    • Saved Food
      • handles displaying food saved locally
  • testing
    • Encompasses the core testing functionality of the project
Modularization Graph

Testing

The app includes unit tests for all modules, Instrumented tests are ran as unit tests with the use of Roboelectric

tests screenshots

Image desc
Unit tests for the ViewModels
Unit tests for the data layer
Unit tests for the network layer
Unit tests for the database layer

TechStack

Libraries

  • Tech-stack

    • Kotlin - a modern, cross-platform, statically typed, general-purpose programming language with type inference.
    • Coroutines - lightweight threads to perform asynchronous tasks.
    • Flow - a stream of data that emits multiple values sequentially.
    • StateFlow - Flow APIs that enable flows to emit updated state and emit values to multiple consumers optimally.
    • Dagger Hilt - a dependency injection library for Android built on top of Dagger that reduces the boilerplate of doing manual injection.
    • Jetpack
      • Jetpack Compose - A modern toolkit for building native Android UI
      • Lifecycle - perform actions in response to a change in the lifecycle state.
      • ViewModel - store and manage UI-related data lifecycle in a conscious manner and survive configuration change.
      • Room - An ORM that provides an abstraction layer over SQLite to allow fluent database access.
    • Timber - a highly extensible Android logger.
    • Ktor - A pure Create asynchronous http client
  • Tests

    • JUnit - a simple framework for writing repeatable tests.
    • MockK - mocking library for Kotlin
    • Truth - A fluent assertions library for Android and Java.
  • Gradle

    • Gradle Kotlin DSL - An alternative syntax for writing Gradle build scripts using Koltin.
    • Version Catalogs - A scalable way of maintaining dependencies and plugins in a multi-module project.
    • Convention Plugins - A way to encapsulate and reuse common build configuration in Gradle
      • Ktlint - creates convenient tasks in your Gradle project that run ktlint checks or do code auto format.
      • Spotless - format Java, groovy, markdown, and license headers using gradle.
  • CI/CD

ScreenShots

Loading Recent Searches Food List
Idle Details Error Screen

About

A project to display nutrition information for different foods

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages