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
@InstallIn(ApplicationComponent::class) | |
@Module | |
object DatabaseModule { | |
/* | |
* The method returns the Database object | |
**/ | |
@Singleton | |
@Provides | |
fun provideAppDatabase(@ApplicationContext context: Context): FootballDatabase = Room.databaseBuilder( |
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
class CompetitionsViewModel @ViewModelInject constructor( | |
private val getTodayFixturesUseCase: GetTodayFixturesUseCase, | |
private val getCompetitionsUseCase: GetCompetitionsUseCase | |
) : ViewModel() { | |
... | |
} |
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
// DataModule | |
@InstallIn(ApplicationComponent::class) | |
@Module | |
object DataModule { | |
... | |
} | |
// DatabaseModule | |
@InstallIn(ApplicationComponent::class) | |
@Module |
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
@AndroidEntryPoint | |
class CompetitionsFragment : BaseFragment() { | |
... | |
/** | |
* This should be deleted as it's no longer needed | |
*/ | |
override fun onAttach(context: Context) { | |
super.onAttach(context) | |
// Inject dagger here |
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
@HiltAndroidApp | |
class MainApplication: Application() |
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
... | |
apply plugin: 'kotlin-kapt' | |
apply plugin: 'dagger.hilt.android.plugin' | |
android { | |
... | |
} | |
dependencies { | |
implementation "com.google.dagger:hilt-android:${Versions.hiltVersion}" |
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
buildscript { | |
... | |
dependencies { | |
... | |
classpath "com.google.dagger:hilt-android-gradle-plugin:${Versions.hiltGradlePluginVersion}" | |
} | |
} |
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
class HomeActivity : BaseActivity() { | |
private lateinit var navController: NavController | |
private lateinit var appBarConfiguration: AppBarConfiguration | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setSupportActionBar(binding.toolbar) | |
initBinding() | |
} |
NewerOlder