Skip to content

A collection of samples to discuss and showcase different architectural tools and patterns for Android apps.

License

Notifications You must be signed in to change notification settings

mifkamaz/android-architecture

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android Architecture Blueprints

Android Architecture Blueprints

The Android framework provides a lot of flexibility in deciding how to organize and architect an Android app. While this freedom is very valuable, it can also lead to apps with large classes, inconsistent naming schemes, as well as mismatching or missing architectures. These types of issues can make testing, maintaining and extending your apps difficult.

The Android Architecture Blueprints project demonstrates strategies to help solve or avoid these common problems. This project implements the same app using different architectural concepts and tools.

You can use the samples in this project as a learning reference, or as a starting point for creating your own apps. The focus of this project is on demonstrating how to structure your code, design your architecture, and the eventual impact of adopting these patterns on testing and maintaining your app. You can use the techniques demonstrated here in many different ways to build apps. Your own particular priorities will impact how you implement the concepts in these projects, so you should not consider these samples to be canonical examples. To ensure the focus is kept on the aims described above, the app uses a simple UI.

Explore the samples

This project hosts each sample app in separate repository branches. For more information, see the README.md file in each branch.

Stable samples - Java

Sample Description
todo‑mvp Demonstrates a basic Model‑View‑Presenter (MVP) architecture and provides a foundation on which the other samples are built. This sample also acts as a reference point for comparing and contrasting the other samples in this project.
todo‑mvp‑clean Uses concepts from Clean Architecture.
todo‑mvp‑dagger Uses Dagger 2 to add support for dependency injection.
todo‑mvp‑rxjava Uses RxJava 2 to implement concurrency, and abstract the data layer.
todo‑mvvm‑databinding Based on the todo-databinding sample, this version incorporates the Model‑View‑ViewModel pattern.
todo‑mvvm‑live Uses ViewModels and LiveData from Architecture Components and the Data Binding library with an MVVM architecture.

Stable samples - Kotlin

Sample Description
todo-mvp-kotlin Conversion of todo-mvp to Kotlin.
todo-mvvm-live-kotlin Conversion of todo-mvvm-live to Kotlin.

External samples

External samples are variants that may not be in sync with the rest of the branches in this repository.

Sample Description
todo‑mvp‑fragmentless Uses View objects instead of Fragment objects.
todo‑mvp‑conductor Uses the Conductor framework to refactor the app to use a single Activity architecture.
todo‑mvi-rxjava Adapts the Model-View-Intent pattern to Android to create a fully reactive architecture.
todo‑mvp-kotlin-coroutines Replaces the asynchronous operations with Kotlin's coroutines.

Deprecated samples

These samples are no longer being maintained, but their implementation is still valid.

Sample Description
todo‑mvp‑loaders Fetches data using the Loaders API.
todo‑databinding Replaced by todo‑mvvm‑databinding
todo‑mvp‑contentproviders Based on the todo-mvp-loaders sample, this version fetches data using the Loaders API, and also makes use of content providers.

Samples in progress

Sample Description
dev‑todo‑mvvm‑rxjava Based on the todo-rxjava sample, this version incorporates the Model‑View‑ViewModel pattern.

For information about planned samples, see "New sample" issues.

Why a to-do app?

The app in this project aims to be simple enough that you can understand it quickly, but complex enough to showcase difficult design decisions and testing scenarios. For more information, see the app's specification.

The following screenshot illustrates the UI of the app:

A screenshot illustratrating the UI of the app

Choose a sample for your app

Each sample includes a dedicated README.md file where you can find related metrics, as well as subjective assessments and observations by contributors. The following factors are worth considering when selecting a particular sample for your app:

  • The size of the app you are developing
  • The size and experience of your team
  • The amount of maintenance that you are expecting to have to do
  • Whether you need a tablet layout
  • Whether you need to support multiple platforms
  • Your preference for the compactness of your codebase

For more information on choosing and comparing samples, see the following pages:

Open a sample in Android Studio

To open one of the samples in Android Studio, begin by checking out one of the sample branches, and then open the todoapp/ directory in Android Studio. The following series of steps illustrate how to open the todo‑mvp sample.

Note: The master branch does not compile.

Clone the repository:

git clone [email protected]:googlesamples/android-architecture.git

Checkout the todo-mvp sample:

git checkout todo-mvp

Note: To review a different sample, replace todo-mvp with the name of sample you want to check out.

Finally open the todoapp/ directory in Android Studio.

Contributors

This project is built by the community, and curated by Google as well as other core maintainers.

External contributors

David González - Core developer (MVP Content Providers sample)

Karumi - Developers (MVP Clean Architecture sample)

Natalie Masse - Core developer

Erik Hellman - Developer (MVP RxJava sample)

Saúl Molinero - Developer (MVP Dagger sample)

Mike Nakhimovich - Developer (MVP Dagger sample)

Voicu Klein - Developer (MVP RxJava sample)

Googlers

Jose Alcérreca - Lead/Core developer

Mustafa Kurtuldu - UX/design

Stephan Linzner - Core developer

Florina Muntenescu - Core developer

Sharif Salah - Technical Writer

Doug Sigelbaum - Kotlin conversion

Ben Weiss - Kotlin conversion

For more information on joining the project, see how to become a contributor and the contributor's guide

About

A collection of samples to discuss and showcase different architectural tools and patterns for Android apps.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published