Code Monkey home page Code Monkey logo

fbada006 / clean_architecture_template_crypto Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 0.0 251 KB

A simple multi-modular template that shows how to work with clean architecture in Android with the MVVM pattern. To use, just change the POJO and modify the tests to pass for any API out there. Have fun. PR's are welcome.

License: Apache License 2.0

Kotlin 100.00%
clean-architecture mvvm-architecture kotlin-android hilt-dependency-injection-android flow multimodule

clean_architecture_template_crypto's Introduction

Build Application Run KtLint Graph

Clean_Architecture_Template_Crypto

Don't you get tired of writing apps that parse data from the API from scratch all the time? This app seeks to simplify this by providing a template that you can modify and use on the fly using clean architecture. It gets data from the the coingecko API and displays the cryptos using clean architecture and MVVM.

Prerequisite

minSdkVersion -> 21

Gradle build system

Kotlin

You do not need an API key for this project

TOC

Architecture

The App is not organized into multiple modules following the principles of the Presentation, Domain, and Data Layers. The presentation layer handles the UI work with the logic contained in the ViewModel. The UI uses a LiveData object from the ViewModel and observes it using the Observer Pattern. A ListAdapter handles the actual displaying of the cryptos. Data over the network is retrieved using retrofit, Flow and coroutines to handle background work asynchronously. Additionally, note that the ViewModel uses the viewModelScope to launch the couroutines while Fragments use the viewLifeCycleOwner to observe data.

Libraries

This app takes use of the following libraries:

  • Jetpack๐Ÿš€
    • Viewmodel - Manage UI data to survive configuration changes and is lifecycle-aware
    • Navigation - Handle everything needed for in-app navigation
    • Flow - The new stream processing API
    • LiveData - Notify views when data changes
  • Retrofit - type safe http client with coroutines support
  • Moshi - Modern JSON library for Android and Java
  • Hilt - Injection library for Android that reduces
  • okhttp-logging-interceptor - logging HTTP request related data.
  • kotlinx.coroutines - Library Support for coroutines
  • Timber - A logger with a small, extensible API which provides utility on top of Android's normal Log class.

Extras

CI-Pipeline

GitHub Actions is used for Continuous Integration every time an update is made to the repo. The work flows build the project and ensure that code quality is maintained using kLint. The work is set to run once a PR is opened

To come

The project will include the ROOM DB because that is also part of the common pattern in modern Android Development. The usage of Kotlin DSL would also be a nice addition. This will also come with other tests but the available ones are enough for now. However, feel free to open a PR if you feel that the project has room for improvement

   Copyright 2020 Ferdinand Bada

   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.

clean_architecture_template_crypto's People

Contributors

fbada006 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.