android10 / android10/Android-CleanArchitecture
Why there is no activity context injection?
- 主要語言
- Java
- 星號
- 15.5k
- 分支
- 3.3k
- PR 合併指標
- 30 天內沒有已合併 PR
描述
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?
貢獻指南
這個儲存庫沒有索引到貢獻指南
評估
這個 Issue 還沒有評估資料。