/resipi

Resipi is a sample app showcasing clean architecture and SOLID principles on Android using MVVM + RxJava

Primary LanguageKotlinMIT LicenseMIT

Resepi - Sample Reference Project

Pronounced as ˈresəˌpē, is a sample application showcasing how to use clean architecture and MVVM on Android using RxJava & RxAndroid.

Resepi Demo

1. Architecture

1.1 Clean Architecture

By using Clean Architecture we can achieve the following benefits:

  • Separation of code in different layers with assigned responsibilities making it easier for further modification.
  • High level of abstraction
  • Loose coupling between the code
  • Testable application

The Clean Architecture consists on three main layers:

  • PRESENTATION LAYER: You can find in this layer the graphical interface that captures the user's event, validate user's entries and shows the results. Common components in this layer are: Activites, Fragments, Dialogs and ViewModels/Presenters.
  • DOMAIN LAYER: This layer contains use cases which are the components in charge of handling the business logic of your application.
  • DATA LAYER: This layer are responsible for managing the data access via either remote or local sources. Common components in this layer are: Model Classes, Repositories with Local and Remote Data Sources, Web services and Local Storage.

Clean Architecture

1.2 Single Activity & Navigation Architecture

This project follow a single Activity pattern and Jetpack Navigation in order to follow these best practices:

  • Use activities as entry points into your app's UI. When a user goes to launch your app, their launching only one activity.
  • Share data between screens by using the activity scope
  • Use the Navigation Architecture Component to make navigating between destinations even easier.
  • Navigate between destinations with the new gradle plugin, Safe arguments passed.
  • Extract your business logic, don't test at the destination level!
  • FragmentScenario for testing and verifying fragments.
  • Mock the NavController to confirm that you're calling the right navigate calls.
  • Inject dependencies with FragmentFactory.
  • Use multiple tasks when appropriate.
  • Don't contort your app architecture. Do what's right for your app.

Single Activity

Jetpack Navigation

2. Dependencies

  • Kotlin: Kotlin libraries as primary app programming language
  • AndroidX: Libraries used as major improvement to the original Android Support Library. AndroidX ships separately from the Android OS and provides backwards-compatibility across Android releases.
  • ViewModel Libraries handling viewModel classes designed to store and manage UI-related data in a lifecycle conscious way.
  • LiveData Libraries handling LiveData as lifecycle-aware, meaning it respects the lifecycle of other app components, such as activities, fragments, or services.
  • Room: Persistence library provides an abstraction layer over SQLite to allow for more robust database access while harnessing the full power of SQLite.
  • Koin: A pragmatic lightweight dependency injection framework for Kotlin developers.
  • MultiDex: Library used when your app and the libraries it references exceed 65,536 method.
  • Navigation: Library which helps you implement navigation, from simple button clicks to more complex patterns, such as app bars and the navigation drawer. The Navigation component also ensures a consistent and predictable user experience.
  • Databinding: is a support library that allows you to bind UI components in your layouts to data sources in your app using a declarative format rather than programmatically.
  • Picasso: Picasso allows for hassle-free image loading in your application—often in one line of code!
  • Lottie:

3. Unit test

  • Windows: gradlew assembleDebug --stacktrace
  • macOS & Linux: ./gradlew assembleDebug --stacktrace

4. Build

Just clone the main branch and import the project to Android Studio, wait for thee IDE to finish building the project and hit run 🧑🏻‍💻

5. CI

This projects includes integration with Github Actions, everytime a pull is merged to the main branch, a new job triggers run the unit test and builds a new APK

6. Design

Inspirations for the design and animations came from:

References