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

cesarnorena/android-architecture

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 

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 in 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

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‑loaders Fetches data using the Loaders API.
todo‑databinding Uses the Data Binding Library.
todo‑mvp‑clean Uses concepts from Clean Architecture.
todo‑mvp‑dagger Uses Dagger2 to add support for dependency injection.
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.
todo‑mvp‑rxjava Uses RxJava 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.

Samples in progress

Sample Description
dev‑todo‑mvp‑tablet Adds a master and detail view for tablets.
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.

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‑mvp‑kotlin A translation of todo-mvp to Kotlin

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 git@github.com: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)

Florina Muntenescu - Developer (MVP RxJava sample)

Googlers

Jose Alcérreca - Lead/Core developer

Stephan Linzner - Core developer

Mustafa Kurtuldu - UX/design

Sharif Salah - Technical Writer

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