bcorreia
I hereby claim:
- I am bffcorreia on github.
- I am bcorreia (https://keybase.io/bcorreia) on keybase.
- I have a public key ASDhAkNmrYNuxRboXw1ez04Bz1vuGwN5sO1TuWRXhMtphgo
To claim this, I am signing this object:
bcorreia
I hereby claim:
To claim this, I am signing this object:
| # This file contains the fastlane.tools configuration | |
| # You can find the documentation at https://docs.fastlane.tools | |
| # | |
| # For a list of all available actions, check out | |
| # | |
| # https://docs.fastlane.tools/actions | |
| # | |
| # Uncomment the line if you want fastlane to automatically update itself | |
| # update_fastlane |
| @Scope @Retention(CLASS) | |
| public @interface ActivityScope { | |
| } |
| @Component(modules = ApplicationModule.class) | |
| public interface ApplicationComponent { | |
| ... | |
| } |
| public class ClassA { | |
| private final Context context; | |
| @Inject public ClassA(Context context) { | |
| this.context = context; // Application Context | |
| } | |
| } | |
| public class ClassB { |
| @Provides | |
| public Context provideApplicationContext() { | |
| return application; | |
| } | |
| @Provides @Named("activity_context") | |
| public Context provideActivityContext() { | |
| return activity; | |
| } |
| @Module public class ActivityModule { | |
| private final Activity activity; | |
| public ActivityModule(Activity activity) { | |
| this.activity = activity; | |
| } | |
| @Provides public Context provideActivityContext() { | |
| return activity; |
| public class EmotionManager { | |
| private final PeanutButterJar peanutButterJar; | |
| private final Benfica benfica; | |
| @Inject public EmotionManager(PeanutButterJar peanutButterJar, Benfica benfica) { | |
| this.peanutButterJar = peanutButterJar; | |
| this.benfica = benfica; | |
| } | |
| public class MainActivity extends AppCompatActivity { | |
| @Inject EmotionManager emotionManager; | |
| @Override protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_main); | |
| getActivityComponent().inject(this); | |
| } | |
| } |
| public class PeanutButterJar { | |
| @Inject public PeanutButterJar() {} | |
| ... | |
| } | |
| public class Benfica { | |
| @Inject public Benfica() {} |