Reddit application implementing Android MVVM + RxJava Architecture
This repository contains Android Reddit application implementing Model–View–ViewModel architecture pattern and RxJava.
Model–View–ViewModel pattern consists of :
-
The View - receives user's actions and notify the ViewModel, shows data from ViewModel
-
The ViewModel - consumes streams of data from DataModel and exposes them to the View
-
The DataModel - abstracts remote or data source and exposes them to ViewModel
Please refer to https://en.wikipedia.org/wiki/Model-view-viewmodel for more detailed information about Model–View–ViewModel pattern.
RxJava extends the Observer pattern to support sequences of data/events so that it can help develop an Android application based on Reactive Programming.
-
The application implements a RESTFul API call with Retrofit and RxJava.
-
RxJava Call adapter of Retrofit makes Observable object used for receiving a response instead of normal Call object.
Please refer to https://github.com/ReactiveX/RxJava for more detailed information about RxJava.
Here is the architecture of this application.
Please refer to https://github.com/googlesamples/android-architecture in order to understand the overall Android Architecture including MVVM.
This application uses RESTful API of Reddit which is a social news aggregation web site in order to get top 20 news posts.
It receives news data formatted in JSON and converts it to Java Objects including news title, photo url, author's name, date, comment's count and so on.
https://www.reddit.com/top.json?after=""&limit=20
This repository is able to help understand how to use the following skills.
- How to implement Android Model-View-ViewModel architecture pattern with RxJava
- How to integrate Retrofit with RxJava through RxJava Call adapter of Retrofit
- How to call RESTful API with Retrofit
- How to use OkHttp Logging Intercepter in order to debug HTTP request/response data
- How to convert JSON to Java Objects with Moshi
- How to load images from a remote server with Glide
- How to reduce boilerplate codes with ButterKnife
- RxJava - Java VM implementation of Reactive Extensions
- Retrofit - Type-safe HTTP client for Android and Java which makes it easier to consume RESTful API services.
- Retrofit 2 RxJava 2 Adapter - Helps handle a response from server with RxJava as custom Call adapter
- OkHttp Logging Intercepter - Logs HTTP request and response data with different logging levels in order to debug HTTP error
- Moshi - JSON library for Android and Java which makes it easy to parse JSON into Java objects. Used with Retrofit Moshi converter
- Glide - A fast and efficient image loading library for Android focused on smooth scrolling which offers an easy to use
- ButterKnife - Binds field and method for Android views with annotation processing and it reduces boilerplate codes
- Arndroid Architecture Blueprints
- TODO-MVVM-RXJAVA of Google
- Model–View–ViewModel pattern
- RxJava
- Reactive Extensions
- Reactive Programming
- Observer pattern
Copyright Jaemoon Hwang <[email protected]>
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.
