Skip to content

Commit 97f0003

Browse files
committed
updateing the local cache
1 parent e96ab17 commit 97f0003

File tree

1 file changed

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

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ public int delete(Uri uri, String selection, String[] selectionArgs) {
171171
} else {
172172
mTasksRemoteDataSource.deleteAllTasks();
173173
rowsDeleted = mTasksLocalDataSource.deleteAllTasks();
174-
175174
mCachedTasks.clear();
176175
}
177176

@@ -191,10 +190,12 @@ public int update(Uri uri, ContentValues values, String selection, String[] sele
191190
}
192191

193192
int rowsUpdated = mTasksLocalDataSource.updateTask(values, selectionArgs);
193+
mCachedTasks.put(newTask.getId(), newTask);
194194

195195
if (rowsUpdated != 0) {
196196
getContext().getContentResolver().notifyChange(uri, null);
197197
}
198+
198199
return rowsUpdated;
199200
}
200201

0 commit comments

Comments
 (0)