An Activity that injects its members in #onCreate(Bundle) and can be used to inject Fragments attached to it.
| 28 | * inject {@link Fragment}s attached to it. |
| 29 | */ |
| 30 | @Beta |
| 31 | public abstract class DaggerActivity extends Activity implements HasFragmentInjector { |
| 32 | |
| 33 | @Inject DispatchingAndroidInjector<Fragment> fragmentInjector; |
| 34 | |
| 35 | @Override |
| 36 | protected void onCreate(@Nullable Bundle savedInstanceState) { |
| 37 | AndroidInjection.inject(this); |
| 38 | super.onCreate(savedInstanceState); |
| 39 | } |
| 40 | |
| 41 | @Override |
| 42 | public AndroidInjector<Fragment> fragmentInjector() { |
| 43 | return fragmentInjector; |
| 44 | } |
| 45 | } |
nothing calls this directly
no outgoing calls
no test coverage detected