Skip to content

Sample app that implement MVVM using android architecture component, Paging, RxJava, Dagger and Data binding

License

Notifications You must be signed in to change notification settings

Ahmed-Abdelmeged/GithubArch

Repository files navigation

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!

About

Sample app that implement MVVM using android architecture component, Paging, RxJava, Dagger and Data binding

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages