Skip to content

Android MVVM project using android architecture components along with Realm database and Dagger 2 dependency injection

License

Notifications You must be signed in to change notification settings

duyp/mvvm-template

Repository files navigation

Android MVVM template project

This project demonstrates how to use Android Architecture Components (View Model, Data Binding, Live Data, lifecycle aware) along with Realm database and Dagger 2 dependency injection to build a robust application (scalable, testable, less bug, easy to maintain, support offline mode and lanscape mode).

App

I used official Github Rest API to develop a Github Application on Android with a lot of features like github webpage.

This project focuses on android application architecture, so, to faster my work, I used some resources and helper classes of Fasthub open source project, but the architecture is definitely different (he used MVP design pattern and SQLite database). Thank k0shk0sh so much for his amazing app!

Sample app:

Download from Google Play

Architecture overview

Comming soon...

Persistence - why Realm, not Room?

Room Persistence Library is a part of google's android architecture components announced Google IO 2017. It provides an abstraction layer over SQLite to allow fluent database access while harnessing the full power of SQLite, works well with LiveData.

But, SQLite is not simple, and relational database is not easy for a lot of android developers. In almost android application, local database is offen used for data caching only, and isn't center of bussiness processes.

Realm is a mobile database, a replacement of SQLite and ORMs. It is much more simple than SQLite, but really powerfull, easy to learn in minutes, not hours, for every mobile deveopers, both Android and iOS. Even "Realm Database is much faster than an ORM, and often faster than raw SQLite". With lazy data loading, your app can easy to archive better performance and user experience, it's really difficult if you are using Room.

Room works well with LiveData and lifecycle aware to prevent memory leaks, how about Realm ?

It dosen't matter, Realm can easy to adapt with LiveData, read more: Android Architecture Components and Realm.

Testing

JUnit 4, Mockito, PowerMock and Robolectric for Unit testing.

Espresso and UI Automator for automated UI testing.

References

Screenshots

Feeds Drawer
First Sec
Repo Profile
Third Fourth

License

Copyright 2017 Duy Pham.

Licensed under the the GPL-3.0 license.

See the LICENSE file for the whole license text.

About

Android MVVM project using android architecture components along with Realm database and Dagger 2 dependency injection

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages