Skip to content

Instantly share code, notes, and snippets.

View hamadycisse's full-sized avatar
🏠
Working from home

H.Cissé hamadycisse

🏠
Working from home
View GitHub Profile
class OurAppInjectionScopes(private val appComponent: AppComponent) : AppInjectionScopes {
override val isInUserScope: Boolean
get() = userScope != null
override var userScope: UserScopeSubcomponent? = null
private set
override fun openUserScope() {
userScope = appComponent.getUserScopeSubcomponentFactory().create()
abstract class InjectedBaseActivity : HasInjectorsBaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
AndroidInjection.inject(this)
super.onCreate(savedInstanceState)
}
}
@Singleton
@Component(modules = [
AppModule::class,
AndroidSupportInjectionModule::class,
ActivityScopeBuilderModule::class,
UserScopeSubcomponentModule::class
])
interface AppComponent : AndroidInjector<OurApp> {
fun getUserScopeSubcomponentFactory() : UserScopeSubcomponent.Factory
public abstract class AuthenticatedBaseActivity
extends ConnectedBaseActivity
implements SlidingDrawer.OnDrawerOpenListener, SlidingDrawer.OnDrawerCloseListener {
@Inject
protected InjectionScopes injectionScopes;
@Override
public void onCreate(Bundle savedInstanceState) {
UserScopeSubcomponent userScope = ((OurApp) getApplication()).getAppScopes().getUserScope();
@Module
abstract class TextToSpeechModule {
@Binds
@UserScope
abstract fun bindsSpeechNotifier(textToSpeechNotificationManager: TextToSpeechNotificationManager): Notifier
@Binds
@UserScope
abstract fun bindsTextToSpeechTextSynthetizer(androidTextToSpeechSynthesizer: AndroidTextToSpeechSynthesizer): TextToSpeechSynthesizer
@Module
abstract class UserScopeActivityBuilderModule {
@UserActivityScope
@ContributesAndroidInjector(modules = [DebugActivityModule::class])
abstract fun contributeDebugActivity(): DebugActivity
}
@UserScope
@Subcomponent(modules = [
AndroidSupportInjectionModule::class,
UserScopeActivityBuilderModule::class,
TextToSpeechModule::class
])
interface UserScopeSubcomponent {
val userScopeActivitiesAndroidInjectorFactories: Map<Class<*>, Provider<AndroidInjector.Factory<*>>>