Cocktails

Mobile App to show various cocktails🍸 🍷 🍹 from the CockTailDB API.Written using Kotlin, Clean Architecture ,MVVM, Room ,DI and other jetpack libraries.

Min Api:21

Prerequisites

Change the prefix of the BASE_URL from www to https in order to successfully load data.

To check for dependency updates, run the following gradlew command:

./gradlew dependencyUpdate

Good thing the plugin does not update dependencies whose versions are not stable yet 🥳 🥳 .

Dependencies

All the dependencies (external libraries) are defined in the single place – Gradle scripts/versions.gradle folder. This approach allows to easily manage dependencies and use the same dependency version across all modules. Each of the tools has its own Gradle file in the scripts folder. This is by design so that if you chose to have a multi module project, these dependencies can easily be shared between them. This is already configured inside our root build.gradle file, by applying to each sub project:

Danger

This template uses Danger which will perform some checks against our pull requests. You can find the list of checks in the Dangerfile. In addition, we have a GitHub Actions workflow for Danger checks. In order for that to work, you’ll need a Danger API key setup in your GitHub secrets. Info on this can be found here.

Architecture

The app is built using the Modular MVVM architectural pattern and makes heavy use of a couple of Android Jetpack components. MVVM allows for the separation of concern which also makes testing easier. The app has a fragment that communicates to ViewModel which in turn communicates to the usecase which communiacates to Repository to get data.

Techstack

  • Tech-stack

    • Kotlin – a cross-platform, statically typed, general-purpose programming language with type inference.

    • Coroutines – perform background operations.

    • Flow – handle the stream of data asynchronously that executes sequentially.

    • KOIN – a pragmatic lightweight dependency injection framework.

    • View Binding – A feature that allows you to more easily write code that interacts with views.

    • Android KTX – Provide concise, idiomatic Kotlin to Jetpack and Android platform APIs.

    • AndroidX – Major improvement to the original Android Support Library, which is no longer maintained.

    • Jetpack🚀

      • Room – a persistence library provides an abstraction layer over SQLite.
      • LiveData – is an observable data holder.
      • Lifecycle – perform action when lifecycle state changes.
      • ViewModel – store and manage UI-related data in a lifecycle conscious way.
      • Git Hooks for automatically perform static analysis checks.
      • Gradle Versions Plugin for checking all dependencies for new versions.
      • Danger which will perform some checks against our pull requests.
  • Architecture

    • MVVM – Model View View Model
  • Gradle

    • Plugins
      • Ktlint – creates convenient tasks in your Gradle project that run ktlint checks or do code auto format.
      • Detekt – a static code analysis tool for the Kotlin programming language.
      • Spotless – format java, groovy, markdown and license headers using gradle.
      • Dokka – a documentation engine for Kotlin, performing the same function as javadoc for Java.
      • Danger – a documentation engine for Kotlin, performing the same function as javadoc for Java.
  • CI/CD

    • Github Actions

Screenshots

The final app looks like this:

Collapsing ToolBar CockTails Shimmer

SlackMessage

Using fastlane to send a message to Slack once our app compiles successfully.

fastlane android debug

|| ||

GitHub

View Github