android10 / android10/Android-CleanArchitecture

Why there is no activity context injection?

オープン
#130 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
discussion question
主要言語
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 はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。