Skip to content

Commit

Permalink
Add FragmentActivity to the list of default bindings for the Activi…
Browse files Browse the repository at this point in the history
…tyComponent and restructure the table to reduce duplication.

RELNOTES=n/a
PiperOrigin-RevId: 625729790
  • Loading branch information
Chang-Eric authored and Dagger Team committed Apr 17, 2024
1 parent 7f1d0a1 commit e690b28
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions hilt/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,18 +189,20 @@ consider using `@Reusable` instead of a component scope.
## Component default bindings {#component-bindings}

Each Hilt component comes with a set of default bindings that can be injected
as dependencies into your own custom bindings.
as dependencies into your own custom bindings. Each component listed has the
corresponding default bindings as well as any default bindings from an
ancestor component.

Component | Default Bindings
------------------------------- | ---------------------------------------------
**`SingletonComponent`** | `Application`[^2]
**`ActivityRetainedComponent`** | `Application`, `ActivityRetainedLifecycle`
**`ActivityRetainedComponent`** | `ActivityRetainedLifecycle`
**`ViewModelComponent`** | `SavedStateHandle`, `ViewModelLifecycle`
**`ActivityComponent`** | `Application`, `Activity`
**`FragmentComponent`** | `Application`, `Activity`, `Fragment`
**`ViewComponent`** | `Application`, `Activity`, `View`
**`ViewWithFragmentComponent`** | `Application`, `Activity`, `Fragment`, `View`
**`ServiceComponent`** | `Application`, `Service`
**`ActivityComponent`** | `Activity`, `FragmentActivity`
**`FragmentComponent`** | `Fragment`
**`ViewComponent`** | `View`
**`ViewWithFragmentComponent`** | `View`
**`ServiceComponent`** | `Service`

[^2]: The `Application` binding is available using either `@ApplicationContext
Context` or `Application`.

0 comments on commit e690b28

Please sign in to comment.