android10 / android10/Android-CleanArchitecture
Why there is no activity context injection?
- Lingua principale
- Java
- Stelle
- 15.5k
- Fork
- 3.3k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I don't know this is a bug or just my misunderstanding?
``` java
@Inject
public UsersAdapter(Context context) {
this.layoutInflater =
(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.usersCollection = Collections.emptyList();
}
```
Here you have injected an adapter. This adapter has a Context type parameter. Apparently this should be an activity context. Because application context lacks the app theme and so on.
But there is no activity context provided in your di. Only application context has been provided.
``` java
@Provides @Singleton Context provideApplicationContext() {
return this.application;
}
```
And I found an activity dependancy provided in ActivityModule.
``` java
@Provides @PerActivity Activity activity() {
return this.activity;
}
```
My question is:
Do you replace activity context with application context? Or with an acitivity casted by di automatically? Or this is just a bug?
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.