Giter VIP home page Giter VIP logo

githubarch's Introduction

Github Arch

This sample code that implement MVVM architecture using Android architecture component intensively and some RxJava

I create this repo for a few reasons:

  1. Help others to understand architecture component in sample way
  2. Understand paging library with RxJava
  3. To use as starting point for future projects
  4. Get feedback from other developers to improve my code

Libraries and tools used

Requirements

  • JDK 1.8
  • Android SDK
  • Latest Android SDK Tools and build tools.

Architecture

The sample app when run will show you a simple list of Github users

Imgur

So the app using Paging library from architecture component at it's core to handle loading and displaying the users list. like this image from official docs

Imgur

At this sample the data source get it's data from Retrofit Service

and the data source handle loading the new data from the API

The Repository is responsible for mange he connection between view model and the data source so the view model doesn't know any thing about the data source it's only consume data from the repository whatever that data source is. also create the PagedList to bass it to the PagedListAdapter to consume and display it. The Activity is only consume the data so it's pretty lightweight and change can handled easily configuration

Databinding is used to bind the data to views to avoid boilerplate code and add more layer of abstraction

RxJava2 is used to get the data from API and do some mapping from Raw data to safe Databinding and give the final result to the data source. Your case maybe more complex or simpler so i prefer using RxJava because it provide powerful thread and error handing and go with you from simplest solution to complex one

Dagger is used for dependency injection of course to make the code more testable and robust

Conclusion

This architecture is similar to what google used in Guide to App Architecture

But enhanced with paging , RxJava2 and Databinding

contribution to improve this architecture is open just make a PR :D

TODO

  • Enable caching
  • Add unit test
  • Add instrumentation test

Thanks

A special thanks to the authors involved with these two repositories, they were a great resource during our learning!

githubarch's People

Contributors

ahmed-abdelmeged avatar

Watchers

James Cloos avatar Berry Huang 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.