Skip to content

Commit bf6e870

Browse files
committed
bring the cache back
1 parent 5cbbf09 commit bf6e870

File tree

1 file changed

+4
-4
lines changed
  • todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/data/source

1 file changed

+4
-4
lines changed

todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/data/source/TasksProvider.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ public boolean onCreate() {
4343
@Override
4444
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
4545
Cursor tasks;
46-
// if (mCachedTasks != null) {
47-
// tasks = getCachedTasks();
48-
// } else {
46+
if (mCachedTasks != null) {
47+
tasks = getCachedTasks();
48+
} else {
4949
tasks = mTasksLocalDataSource.getTasks(selection, selectionArgs);
5050
if (null == tasks || tasks.getCount() == 0) {
5151
List<Task> taskList = mTasksRemoteDataSource.getTasks();
5252
saveTasksInLocalDataSource(taskList);
5353
}
54-
// }
54+
}
5555
tasks.setNotificationUri(getContext().getContentResolver(), uri);
5656
return tasks;
5757
}

0 commit comments

Comments
 (0)