This repository has been archived by the owner on Feb 17, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #599 from squanchy-dev/optimising_dagger_pt2
Optimising dagger pt2
- Loading branch information
Showing
26 changed files
with
140 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 13 additions & 5 deletions
18
app/src/main/java/net/squanchy/imageloader/ImageLoaderComponent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
package net.squanchy.imageloader | ||
|
||
import android.app.Activity | ||
import androidx.appcompat.app.AppCompatActivity | ||
import dagger.BindsInstance | ||
import dagger.Component | ||
import net.squanchy.injection.ActivityContextModule | ||
|
||
fun imageLoaderComponent(activity: AppCompatActivity): ImageLoaderComponent = | ||
internal fun imageLoaderComponent(activity: AppCompatActivity): ImageLoaderComponent = | ||
DaggerImageLoaderComponent.builder() | ||
.activityContextModule(ActivityContextModule(activity)) | ||
.imageLoaderModule(ImageLoaderModule()) | ||
.activity(activity) | ||
.build() | ||
|
||
@Component(modules = [ImageLoaderModule::class]) | ||
interface ImageLoaderComponent { | ||
internal interface ImageLoaderComponent { | ||
|
||
fun imageLoader(): ImageLoader | ||
|
||
@Component.Builder | ||
interface Builder { | ||
@BindsInstance | ||
fun activity(activity: Activity): Builder | ||
|
||
fun build(): ImageLoaderComponent | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
app/src/main/java/net/squanchy/injection/ActivityContextModule.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
app/src/main/java/net/squanchy/injection/ApplicationContextModule.kt
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
app/src/main/java/net/squanchy/injection/BaseActivityComponentBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package net.squanchy.injection | ||
|
||
import android.app.Activity | ||
import dagger.BindsInstance | ||
|
||
interface BaseActivityComponentBuilder<T> { | ||
fun applicationComponent(applicationComponent: ApplicationComponent): BaseActivityComponentBuilder<T> | ||
@BindsInstance | ||
fun activity(activity: Activity): BaseActivityComponentBuilder<T> | ||
|
||
fun build(): T | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.