You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: todoapp/README.md
+42-42Lines changed: 42 additions & 42 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# TODO-MVP-Loaders
2
2
3
-
It is based on the [TODO-MVP](https://github.com/googlesamples/android-architecture/tree/todo-mvp/todoapp) sample and uses Loaders to get the data from the tasks repository.
3
+
It is based on the [TODO-MVP](https://github.com/googlesamples/android-architecture/tree/todo-mvp/todoapp) sample and uses Loaders to get the data from the tasks repository.
The Loaders ([TaskLoader](https://github.com/googlesamples/android-architecture/blob/todo-mvp-loaders/todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/data/source/TaskLoader.java) and [TasksLoader](https://github.com/googlesamples/android-architecture/blob/todo-mvp-loaders/todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/data/source/TasksLoader.java)) are responsible for fetching the data and extend AsyncTaskLoader.
20
+
The Loaders ([TaskLoader](https://github.com/googlesamples/android-architecture/blob/todo-mvp-loaders/todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/data/source/TaskLoader.java) and [TasksLoader](https://github.com/googlesamples/android-architecture/blob/todo-mvp-loaders/todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/data/source/TasksLoader.java)) are responsible for fetching the data and extend AsyncTaskLoader.
21
21
22
22
In [src/data/source/TasksLoader.java](https://github.com/googlesamples/android-architecture/blob/todo-mvp-loaders/todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/data/source/TasksLoader.java):
23
23
24
24
25
-
```
26
-
@Override
27
-
public List<Task> loadInBackground() {
28
-
return mRepository.getTasks();
29
-
}
25
+
```java
26
+
@Override
27
+
publicList<Task> loadInBackground() {
28
+
return mRepository.getTasks();
29
+
}
30
30
```
31
31
The results are received in the UI Thread, handled by the presenter.
32
32
33
33
In [TasksPresenter.java](https://github.com/googlesamples/android-architecture/blob/todo-mvp-loaders/todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/tasks/TasksPresenter.java)
34
34
35
35
36
-
```
37
-
@Override
38
-
public void onLoadFinished(Loader<List<Task>> loader, List<Task>
@@ -64,30 +64,30 @@ After every content change in the repository, <code>notifyContentObserver()</cod
64
64
In [src/data/source/TasksRepository.java](https://github.com/googlesamples/android-architecture/blob/todo-mvp-loaders/todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/data/source/TasksRepository.java):
This notifies the Loader which in this case simply forces a reload of data.
80
80
81
81
In [TasksLoader.java](https://github.com/googlesamples/android-architecture/blob/todo-mvp-loaders/todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/data/source/TasksLoader.java):
82
82
83
83
84
-
```
85
-
@Override
86
-
public void onTasksChanged() {
87
-
if (isStarted()) {
88
-
forceLoad();
89
-
}
84
+
```java
85
+
@Override
86
+
publicvoid onTasksChanged() {
87
+
if (isStarted()) {
88
+
forceLoad();
90
89
}
90
+
}
91
91
```
92
92
## Additional dependencies
93
93
@@ -98,11 +98,11 @@ This project uses the Loaders framework available from Android 3.0 (API Level
98
98
99
99
### Complexity - understandability
100
100
101
-
#### Use of architectural frameworks/libraries/tools:
101
+
#### Use of architectural frameworks/libraries/tools:
102
102
103
-
No external frameworks.
103
+
No external frameworks.
104
104
105
-
#### Conceptual complexity
105
+
#### Conceptual complexity
106
106
107
107
Developers need to be familiar with the Loaders framework, which is not
108
108
trivial.
@@ -121,7 +121,7 @@ No difference with MVP.
121
121
### Code metrics
122
122
123
123
Compared to MVP, the only new classes are TaskLoader and TasksLoader. Parts of
124
-
the code are simpler as Loaders take care of the asynchronous work.
124
+
the code are simpler as Loaders take care of the asynchronous work.
0 commit comments