android10 / android10/Android-CleanArchitecture

Why there is no activity context injection?

Đang mở
#130 5 bình luận 0 reaction 0 người được giao Xem trên GitHub
discussion question
Ngôn ngữ chính
Java
Star
15.5k
Fork
3.3k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.