The repository demonstrates three different architectural patterns that we can use to build the Android app.
The same sample app is built three times using the following approaches:
- Standard/Massive Activity: traditional approach where we put what we can under activities/fragments
- MVP: Model View Presenter
- MVVM: Model View ViewModel
The demo app displays simple list of Github public repositories for a given username. When user taps on one of them, the app will open new view with simple details.
- AppCompat, CardView and RecyclerView
- RxJava2 & RxAndroid2
- Retrofit 2
- Dagger 2
- Butterknife
A project where some API work is handled in some separate class but generally a view (in our case activities) knows about our model/API layer. These two fellows knows about each other.
Here, our Activities/Fragments become a part of the 'view' layer and they delegate most of the work to presenters. Each activity or fragment has it's own presenter that handles user interaction and manage the data based on these actions. Note, that writing unit tests for presenters become very easy by mocking the view layer! Hurra, no more 'Error java.lang.RuntimeException: Stub!'
This approach supports two-way data binding between 'view' and 'View Model'. This enables automatic propagation of changes, within the state of view model to the View. Also here, we should have one ViewModel to one activity/fragment. Also here, writting unit tests becomes easier because the ViewModels are decoupled from the view. The view knows about ViewModel but ViewModel doesn't know anything about the view. It knows only our model layer.
- SDK version 24 (uses Jack and Jill tool chain and Java 8 features)
- GitHub token : just fill out the github_token under config.xml file with your GitHub Personal access token
android-mvp-mvvm-redux-history android-databinding-goodbye-presenter-hello-viewmodel
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.

