architecture-components-samples icon indicating copy to clipboard operation
architecture-components-samples copied to clipboard

Injected Activity should be marked with Injectable, not HasSupportFragmentInjector

Open micHar opened this issue 8 years ago • 0 comments

The AppInjector class looks for activities with HasSupportFragmentInjector interface overridden and then calls AndroidInjection.inject(activity); on them. I think it would make more sense if it looked for Injectable. HasSupportFragmentInjector should be rather used to mark activities which inflate support fragments which need to be injected via dagger. In the example there's only one activity which does both, but there can be situations where it's not really semantically correct.

See here, line 80: https://github.com/googlesamples/android-architecture-components/blob/master/GithubBrowserSample/app/src/main/java/com/android/example/github/di/AppInjector.java

micHar avatar Oct 11 '17 13:10 micHar