Android App Architecture Demo - MVVM with databinding (Java version) [Kotlin version] [中文版]

This is a sample project to demonstrate the Android application architecture with MVVM pattern, a simple client for The Movie DB web API.

Note: you will need an API key if you would like to run the application, see Get started.

Table of Contents

Why MVVM?

For client application development, MVVM is better than other MV* patterns like MVC or MVP.

Why? Because a view model, as the extra abstraction of the view's data and behavior, has a higher abstraction level than other MV* patterns. Furthermore, view models are totally decoupled from views through databinding. The higher abstraction level and more complete decoupling lead to a cleaner architecture.

Any benefit comes with a cost, the abstraction and separation are not free. For projects that are complex enough, these initial cost will pay off soon. But for simple applications, it may be overkill.

For this demo project, using MVVM seems a little bit over engineering. But my purpose here is to demonstrate with a working example that is not too simple, and dealing with real problems in a real project. Furthermore, for a project whose goal is a full featured application like the client for "The Movie DB", this will be a good start.

Screenshots

Now Playing Page Movie Details Page Favorites

Application Introduction

The application has the following features:

Most of the classe names are obvious. For those not so obvious:

Reusable Components

Project independent reusable components are developed in separate modules.

Common

External Libraries/Frameworks/Widgets

The usage of the following well know libraries/frameworks/widgets are demonstrated in this project:

Notes

The signing configs comes from the project's gradle.properties file. You should add the following if you would like to sign the APK with your own key:

# signingConfigs for release build
RELEASE_STORE_FILE=xxx.xxx
RELEASE_STORE_PASSWORD=xxx
RELEASE_KEY_ALIAS=xxx
RELEASE_KEY_PASSWORD=xxx

License

Copyright (C) 2018, Brian He

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.