Skip to content

Commit 0267e4a

Browse files
committed
Merge branch 'githubMaster' into reactive
2 parents e664958 + 89becf6 commit 0267e4a

File tree

4 files changed

+76
-5
lines changed

4 files changed

+76
-5
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ jobs:
7171
sudo gcloud firebase test android run \
7272
--app app/build/outputs/apk/mock/debug/app-mock-debug.apk \
7373
--test app/build/outputs/apk/androidTest/mock/debug/app-mock-debug-androidTest.apk \
74-
--results-bucket cloud-test-${GOOGLE_PROJECT_ID}-testingcodelab \
74+
--results-bucket cloud-test-${GOOGLE_PROJECT_ID}-blueprints \
7575
--results-dir=${BUILD_DIR}
7676
- run:
7777
name: Download results
7878
command: |
7979
BUILD_DIR=build_${CIRCLE_BUILD_NUM}
8080
sudo pip install -U crcmod
8181
mkdir firebase_test_results
82-
sudo gsutil -m mv -r -U `sudo gsutil ls gs://cloud-test-${GOOGLE_PROJECT_ID}-testingcodelab/${BUILD_DIR} | tail -1` firebase_test_results/ | true
82+
sudo gsutil -m mv -r -U `sudo gsutil ls gs://cloud-test-${GOOGLE_PROJECT_ID}-blueprints/${BUILD_DIR} | tail -1` firebase_test_results/ | true
8383
- store_artifacts:
8484
path: firebase_test_results
8585
workflows:

README.md

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,75 @@
1-
todo
1+
# Android Architecture Blueprints v2
2+
<p align="center">
3+
<img src="https://github.com/googlesamples/android-architecture/wiki/images/aab-logov2.png" alt="Android Architecture Blueprints"/>
4+
</p>
25

6+
Android Architecture Blueprints is a project to showcase different architectural approaches to developing Android apps. In its different branches you'll find the same app (a TODO app) implemented with small differences.
7+
8+
In this branch you'll find:
9+
* Kotlin **[Coroutines](https://kotlinlang.org/docs/reference/coroutines-overview.html)** for background operations.
10+
* A single-activity architecture, using the **[Navigation component](https://developer.android.com/guide/navigation/navigation-getting-started)** to manage fragment operations.
11+
* A presentation layer that contains a fragment (View) and a **ViewModel** per screen (or feature).
12+
* Reactive UIs using **LiveData** observables and **Data Binding**.
13+
* A **data layer** with a repository and two data sources (local using Room and remote) that are queried with one-shot operations (no listeners or data streams).
14+
* Two **product flavors**, `mock` and `prod`, [to ease development and testing](https://android-developers.googleblog.com/2015/12/leveraging-product-flavors-in-android.html) (except in the Dagger branch).
15+
* A collection of unit, integration and e2e **tests**, including "shared" tests that can be run on emulator/device or Robolectric.
16+
17+
## Variations
18+
19+
This project hosts each sample app in separate repository branches. For more information, see the `README.md` file in each branch.
20+
21+
### Stable samples - Kotlin
22+
| Sample | Description |
23+
| ------------- | ------------- |
24+
| [master](https://github.com/googlesamples/android-architecture/tree/master) | The base for the rest of the branches. Uses Kotlin, Architecture Components, coroutines, Data Binding, etc. |
25+
| [dagger-android](https://github.com/googlesamples/android-architecture/tree/dagger-android) | A simple Dagger setup that uses `dagger-android` and removes the two flavors. |
26+
| [usecases](https://github.com/googlesamples/android-architecture/tree/usecases) | Adds a new domain layer that uses UseCases for business logic. |
27+
28+
### Samples in development - Kotlin
29+
30+
| Sample | Description |
31+
| ------------- | ------------- |
32+
| [reactive](https://github.com/googlesamples/android-architecture/tree/reactive) | Modifies the data layer so UIs react to changes automatically using Room as source of truth. |
33+
34+
### Old samples - Kotlin and Java
35+
36+
Blueprints v1 had a collection of samples that are not maintained anymore, but can still be useful. See [all project branches](https://github.com/googlesamples/android-architecture/branches).
37+
38+
## Why a to-do app?
39+
40+
<img align="right" src="https://github.com/googlesamples/android-architecture/wiki/images/todoapp.gif" alt="A demo illustraating the UI of the app" width="288" height="512" style="display: inline; float: right"/>
41+
42+
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](https://github.com/googlesamples/android-architecture/wiki/To-do-app-specification).
43+
44+
## What is it not?
45+
46+
* A UI/Material Design sample. The interface of the app is deliberately kept simple to focus on architecture. Check out [Plaid](https://github.com/android/plaid) instead.
47+
* A complete Jetpack sample covering all libraries. Check out [Android Sunflower](https://github.com/googlesamples/android-sunflower) or the advanced [Github Browser Sample](https://github.com/googlesamples/android-architecture-components/tree/master/GithubBrowserSample) instead.
48+
* A real production app with network access, user authentication, etc. Check out the [Google I/O app](https://github.com/google/iosched), [Santa Tracker](https://github.com/google/santa-tracker-android) or [Tivi](https://github.com/chrisbanes/tivi) for that.
49+
50+
## Who is it for?
51+
52+
* Intermediate developers and beginners looking for a way to structure their app in a testable and maintainable way.
53+
* Advanced developers looking for quick reference.
54+
55+
## Opening a sample in Android Studio
56+
57+
To open one of the samples in Android Studio, begin by checking out one of the sample branches, and then open the root directory in Android Studio. The following series of steps illustrate how to open the [usecases](tree/usecases/) sample.
58+
59+
Clone the repository:
60+
61+
```
62+
git clone [email protected]:googlesamples/android-architecture.git
63+
```
64+
This step checks out the master branch. If you want to change to a different sample:
65+
66+
```
67+
git checkout usecases
68+
```
69+
70+
**Note:** To review a different sample, replace `usecases` with the name of sample you want to check out.
71+
72+
Finally open the `android-architecture/` directory in Android Studio.
373

474
### License
575

app/src/main/res/layout/task_item.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
android:layout_height="wrap_content"
5454
android:layout_gravity="center_vertical"
5555
android:layout_marginLeft="@dimen/activity_horizontal_margin"
56+
android:layout_marginStart="@dimen/activity_horizontal_margin"
5657
android:textAppearance="@style/TextAppearance.AppCompat.Title"
5758
android:text="@{task.titleForList}"
5859
app:completedTask="@{task.completed}" />

app/src/test/java/com/example/android/architecture/blueprints/todoapp/data/source/DefaultTasksRepositoryTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class DefaultTasksRepositoryTest {
200200
fun getTask_repositoryCachesAfterFirstApiCall() = runBlockingTest {
201201
// Trigger the repository to load data, which loads from remote
202202
tasksRemoteDataSource.tasks = mutableListOf(task1)
203-
val initial = tasksRepository.getTask(task1.id, true)
203+
tasksRepository.getTask(task1.id, true)
204204

205205
// Configure the remote data source to store a different task
206206
tasksRemoteDataSource.tasks = mutableListOf(task2)
@@ -217,7 +217,7 @@ class DefaultTasksRepositoryTest {
217217
fun getTask_forceRefresh() = runBlockingTest {
218218
// Trigger the repository to load data, which loads from remote and caches
219219
tasksRemoteDataSource.tasks = mutableListOf(task1)
220-
val initial = tasksRepository.getTask(task1.id)
220+
tasksRepository.getTask(task1.id)
221221

222222
// Configure the remote data source to return a different task
223223
tasksRemoteDataSource.tasks = mutableListOf(task2)

0 commit comments

Comments
 (0)