Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- abstract class SunshineBaseActivity: AppCompatActivity(), IScreenNavigator
- {
- @Inject lateinit var mContext: Context
- ....//
- }
- class SunshineApp: Application()
- {
- companion object
- {
- fun getInstance(context: Context): SunshineApp
- {
- return context.applicationContext as SunshineApp
- }
- }
- val appComponent: AppComponent by lazy {
- DaggerAppComponent.builder().appModule(AppModule(this)).
- networkModule(NetworkModule()).build()
- }
- override fun onCreate()
- {
- super.onCreate()
- appComponent.inject(this)
- }
- }
- @Module
- class AppModule(val app: SunshineApp)
- {
- @Provides
- @Singleton
- fun provideApp() = app
- @Provides
- @Singleton
- fun provideContext(): Context
- {
- return app
- }
- @Provides
- @Singleton
- fun getLayoutInflater(app: SunshineApp): LayoutInflater
- {
- return LayoutInflater.from(app)
- }
- }
Add Comment
Please, Sign In to add comment