Skip to content

Commit

Permalink
Synced latest changes from parent repo.
Browse files Browse the repository at this point in the history
  • Loading branch information
ravidsrk committed Oct 28, 2016
1 parent f5ba64f commit 66a0c54
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions generators/app/templates/todo-mvp-dagger/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ dependencies {
// Dependencies for Android unit tests
androidTestCompile "junit:junit:$rootProject.ext.junitVersion"
androidTestCompile "org.mockito:mockito-core:$rootProject.ext.mockitoVersion"
androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
androidTestCompile "com.google.dexmaker:dexmaker:$rootProject.ext.dexmakerVersion"
androidTestCompile "com.google.dexmaker:dexmaker-mockito:$rootProject.ext.dexmakerVersion"

// Espresso UI Testing
androidTestCompile "com.android.support.test.espresso:espresso-core:$rootProject.espressoVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void onCreate() {

mRepositoryComponent = DaggerTasksRepositoryComponent.builder()
.applicationModule(new ApplicationModule((getApplicationContext())))
.tasksRepositoryModule(new TasksRepositoryModule()).build();
.build();

}

Expand Down
1 change: 1 addition & 0 deletions generators/app/templates/todo-mvp-dagger/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ ext {
rulesVersion = '0.5'
espressoVersion = '2.2.2'
daggerVersion = '2.2'
dexmakerVersion = '1.2'
}
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public void clearCompletedTasks() {
* Gets tasks from local data source (sqlite) unless the table is new or empty. In that case it
* uses the network data source. This is done to simplify the sample.
* <p>
* Note: {@link LoadTasksCallback#onDataNotAvailable()} is fired if both data sources fail to
* Note: {@link GetTaskCallback#onDataNotAvailable()} is fired if both data sources fail to
* get the data.
*/
@Override
Expand All @@ -221,6 +221,11 @@ public void getTask(@NonNull final String taskId, @NonNull final GetTaskCallback
mTasksLocalDataSource.getTask(taskId, new GetTaskCallback() {
@Override
public void onTaskLoaded(Task task) {
// Do in memory cache update to keep the app UI up to date
if (mCachedTasks == null) {
mCachedTasks = new LinkedHashMap<>();
}
mCachedTasks.put(task.getId(), task);
callback.onTaskLoaded(task);
}

Expand All @@ -229,6 +234,11 @@ public void onDataNotAvailable() {
mTasksRemoteDataSource.getTask(taskId, new GetTaskCallback() {
@Override
public void onTaskLoaded(Task task) {
// Do in memory cache update to keep the app UI up to date
if (mCachedTasks == null) {
mCachedTasks = new LinkedHashMap<>();
}
mCachedTasks.put(task.getId(), task);
callback.onTaskLoaded(task);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
android:id="@+id/tasksContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:orientation="vertical">

<LinearLayout
Expand Down

0 comments on commit 66a0c54

Please sign in to comment.