Android框架在定義怎樣組織和架構androidapp的時候,提供了很多的靈活性。
這個自由,非常的有價值,可以使得app及時使用了很大的類,可以讓命名和架構不會使得測試,維護,和拓展造成困難。
Android Architecture Blueprints 展示瞭解決常見問題的可能方法。在這個項目中我們使用了不同的概念和工具來構架了同一個應用。
你可以把這些例子看做是參考或者你的app的啓發點。這裏的重點是代碼的結構,架構,測試和維護。然而,要記住,使用這些架構和工具構建app有很多種方法,這取決於你的 優先級,所有這個標準不應該是一個嚴格的例子。這裏UI有意保持簡單的樣子。
例子
所有的項目都在他們的分支上發佈了。閱讀項目的README來獲取更多的信息。
Samples
All projects are released in their own branch. Check each project's README for more information.
Stable samples
- todo-mvp/ - Basic Model-View-Presenter architecture.
- todo-mvp-loaders/ - Based on todo-mvp, fetches data using Loaders.
- todo-mvp-databinding/ - Based on todo-mvp, uses the Data Binding Library.
- todo-mvp-clean/ - Based on todo-mvp, uses concepts from Clean Architecture.
- todo-mvp-dagger/ - Based on todo-mvp, uses Dagger2 for Dependency Injection
- todo-mvp-contentproviders/ - Based on todo-mvp-loaders, fetches data using Loaders and uses Content Providers
Samples in progress
- dev-todo-mvp-rxjava/ - Based on todo-mvp, uses RxJava for concurrency and data layer abstraction.
Also, see "New sample" issues for planned samples.
External samples
These are community contributions that may not be in sync with the rest of the branches.
- todo-mvp-fragmentless/ - Based on todo-mvp, uses Android views instead of Fragments.
What does beta mean?
We're still making decisions that could affect all samples so we're keeping the initial number of variants low before the stable release.
Why a to-do application?
The aim of the app is to be simple enough that it's understood quickly, but complex enough to showcase difficult design decisions and testing scenarios. Check out the app's specification.
Also, a similar project exists to compare JavaScript frameworks, called TodoMVC.
我的app應該選擇哪個例子呢?你因該自己決定:在每一個例子中都有一個README文件,其中有度量以及主觀評價。