36 lines
821 B
Java
36 lines
821 B
Java
package com.bspeice.daggeraaexample.daggeraaexample;
|
|
|
|
import javax.inject.Singleton;
|
|
|
|
import dagger.Module;
|
|
import dagger.Provides;
|
|
|
|
/**
|
|
* Created by bspeice on 5/10/14.
|
|
*/
|
|
@Module (
|
|
injects = {
|
|
MainActivity.class,
|
|
DaggerAAExample.class
|
|
}
|
|
)
|
|
public class DaggerAAExampleModules {
|
|
|
|
/*
|
|
Following code does not work. AAPrefs_ is the java file generated by Android Annotations.
|
|
|
|
@Provides // @Singleton // Same behavior with and without @Singleton
|
|
AAPrefs_ providePrefs() {
|
|
return new AAPrefs_(DaggerAAExample.getApplication());
|
|
}
|
|
*/
|
|
|
|
/*
|
|
Following code **does** work, despite AAPrefsBuild being just a copy-and-rename of AAPrefs
|
|
*/
|
|
@Provides
|
|
AAPrefsBuild providePrefs() {
|
|
return new AAPrefsBuild(DaggerAAExample.getApplication());
|
|
}
|
|
}
|