HamdiBoumaiza Stars Save

An android application build with a clean architecture approach and Star wars API

Project README

About StarWars App

Hello there , In this project I tried showcasing how to build an Android Application with clean architecture and MVVM using some of the jetpack libraries with Kotlin Coroutines & Dagger2. This App is using the Star Wars API as a remote data source.

This side Project was initially a case study given to me as a challenge for an android role.

I wrote an article a while back in which i talked about some the choices i take when developing an android application.

This app is based on the Guide to app architecture article, Kotlin 1.4, and coroutine. I also used some android architecture components like LiveData, ViewModel.

Screenshots

Project Architecture

Communication between layers

  1. UI calls method from ViewModel.
  2. ViewModel executes Use case.
  3. Use case executes one or multiple Repositorie function.
  4. The Repository returns data from one or multiple Data Sources. the repository is the single source of truth
  5. Information flows back to the UI where we display the data fetched from data sources.

I made a diagram to show the flow of the data between the three layers(data, domain , presentation) data flow diagram

Project Structure

  • Data
    • This is my data layer and consisted of the Room Database associated classes, the Network related classes including the CoinsService interface, and the Repository class as well as the local and remote data sources
  • Domain
    • This is the domain layer and consists of the domain model as well as the domain mapper
  • UI
    • This is the presentation layer. I have set up packages by feature here. This consists of the view related code.
  • DI
    • This is where Dagger related code lives ,connected to the different layers of the application
  • Utils
    • This is where most extension functions and constants and some other utils functions exist.

Libraries Used

  • ViewModel - store and manage UI-related data in a lifecycle conscious way
  • StateFlow - enable flows to optimally emit state updates and emit values to multiple consumers..
  • ViewBinding - write code that interacts with views more easily
  • Material - Material Components.
  • Coroutine - performs background tasks
  • Flows - for asynchronous data streams
  • Retrofit2- networking
  • Gson - JSON Parser
  • Dagger2 - dependency injector
  • Stetho - debug bridge
  • Espresso // UI test
  • Barsita -UI tests Built on top of Espresso
  • Junit // unit tests
  • Truth // Makes your test assertions and failure messages more readable

To be added

  • more testing
  • animations

License 🔖

    Apache 2.0 License


    Copyright 2021 Hamdi Boumaiza

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

Open Source Agenda is not affiliated with "HamdiBoumaiza Stars" Project. README Source: HamdiBoumaiza/Stars

Open Source Agenda Badge

Open Source Agenda Rating