-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change signatures of provider functions in di package
- Loading branch information
Showing
7 changed files
with
35 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,4 @@ interface LogModule { | |
@Binds | ||
@Singleton | ||
fun provideLog(logImpl: LogImpl): Log | ||
|
||
} |
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
14 changes: 5 additions & 9 deletions
14
app/src/main/java/com/nanamare/movie/di/app/ResourceModule.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,22 +1,18 @@ | ||
package com.nanamare.movie.di.app | ||
|
||
import android.content.Context | ||
import com.nanamare.movie.provider.ResourceProvider | ||
import com.nanamare.movie.provider.ResourceProviderImpl | ||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
@InstallIn(SingletonComponent::class) | ||
@Module | ||
class ResourceModule { | ||
abstract class ResourceModule { | ||
|
||
@Singleton | ||
@Provides | ||
fun provideResource(@ApplicationContext context: Context): ResourceProvider = | ||
ResourceProviderImpl(context) | ||
|
||
} | ||
@Binds | ||
abstract fun provideResource(provider: ResourceProviderImpl): ResourceProvider | ||
} |
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
8 changes: 5 additions & 3 deletions
8
app/src/main/java/com/nanamare/movie/provider/ResourceProviderImpl.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,9 +1,11 @@ | ||
package com.nanamare.movie.provider | ||
|
||
import android.content.Context | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
|
||
class ResourceProviderImpl(private val context: Context) : ResourceProvider { | ||
class ResourceProviderImpl( | ||
@ApplicationContext private val context: Context | ||
) : ResourceProvider { | ||
|
||
override fun getString(id: Int): String = context.getString(id) | ||
|
||
} | ||
} |
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