Skip to content

Commit 04fe726

Browse files
author
David Weiser
committed
updates dagger 2 code example
1 parent 35412e4 commit 04fe726

7 files changed

Lines changed: 11 additions & 60 deletions

File tree

com.vogella.android.github.issuetracker/app/build.gradle

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
22

33
android {
44
compileSdkVersion 25
5-
buildToolsVersion "25.0.2"
5+
buildToolsVersion "25.0.3"
66
defaultConfig {
77
applicationId "com.vogella.android.github.issuetracker"
88
minSdkVersion 15
@@ -41,11 +41,6 @@ android {
4141
}
4242
}
4343

44-
repositories{
45-
maven{
46-
url 'https://oss.sonatype.org/content/repositories/snapshots/'
47-
}
48-
}
4944
dependencies {
5045
compile fileTree(dir: 'libs', include: ['*.jar'])
5146
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
@@ -59,11 +54,11 @@ dependencies {
5954
compile 'com.squareup.okhttp3:logging-interceptor:3.7.0'
6055
compile "com.android.support:recyclerview-v7:25.3.1"
6156

62-
compile 'com.google.dagger:dagger:HEAD-SNAPSHOT'
63-
compile 'com.google.dagger:dagger-android:HEAD-SNAPSHOT'
64-
compile 'com.google.dagger:dagger-android-support:HEAD-SNAPSHOT'
65-
annotationProcessor 'com.google.dagger:dagger-android-processor:HEAD-SNAPSHOT'
66-
annotationProcessor 'com.google.dagger:dagger-compiler:HEAD-SNAPSHOT'
57+
compile 'com.google.dagger:dagger:2.11'
58+
compile 'com.google.dagger:dagger-android:2.11'
59+
compile 'com.google.dagger:dagger-android-support:2.11'
60+
annotationProcessor 'com.google.dagger:dagger-android-processor:2.11'
61+
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
6762

6863
androidTestCompile 'junit:junit:4.12'
6964
}

com.vogella.android.github.issuetracker/app/src/androidTest/java/com/vogella/android/github/issuetracker/ExampleInstrumentedTest.java

Lines changed: 0 additions & 26 deletions
This file was deleted.

com.vogella.android.github.issuetracker/app/src/main/java/com/vogella/android/github/issuetracker/MyApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class MyApplication extends Application implements HasActivityInjector {
1717
@Override
1818
public void onCreate() {
1919
super.onCreate();
20-
DaggerIApplicationComponent.create().inject(this);
20+
DaggerMyApplicationComponent.create().inject(this);
2121
}
2222

2323
@Override

com.vogella.android.github.issuetracker/app/src/main/java/com/vogella/android/github/issuetracker/IApplicationComponent.java renamed to com.vogella.android.github.issuetracker/app/src/main/java/com/vogella/android/github/issuetracker/MyApplicationComponent.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
import dagger.android.AndroidInjectionModule;
55
import dagger.android.AndroidInjector;
66

7-
@Component(modules = {AndroidInjectionModule.class, ApplicationModule.class})
8-
public interface IApplicationComponent extends AndroidInjector<MyApplication> {
7+
@Component(modules = {AndroidInjectionModule.class, MyApplicationModule.class})
8+
public interface MyApplicationComponent extends AndroidInjector<MyApplication> {
99
}

com.vogella.android.github.issuetracker/app/src/main/java/com/vogella/android/github/issuetracker/ApplicationModule.java renamed to com.vogella.android.github.issuetracker/app/src/main/java/com/vogella/android/github/issuetracker/MyApplicationModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import dagger.android.ContributesAndroidInjector;
55

66
@Module
7-
public abstract class ApplicationModule {
7+
public abstract class MyApplicationModule {
88
@ContributesAndroidInjector(modules = GithubApiModule.class)
99
abstract MainActivity contributeMainActivity();
1010
}

com.vogella.android.github.issuetracker/app/src/test/java/com/vogella/android/github/issuetracker/ExampleUnitTest.java

Lines changed: 0 additions & 18 deletions
This file was deleted.

com.vogella.android.github.issuetracker/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.3.1'
8+
classpath 'com.android.tools.build:gradle:2.3.3'
99

1010
// NOTE: Do not place your application dependencies here; they belong
1111
// in the individual module build.gradle files

0 commit comments

Comments
 (0)